Sha256: 45e472e9ee271bc5c018ea3aabc856a3c6074d9f4a2559a835c98d1e02f7bf8b

Contents?: true

Size: 586 Bytes

Versions: 19

Compression:

Stored size: 586 Bytes

Contents

require 'active_support/core_ext/module/aliasing'
require 'roqua/support/log_wrapper'

module Roqua
  module Logging
    def self.included(base)
      base.extend ClassMethods
    end

    module ClassMethods
      def log(method_name, message, options = {})
        define_method(:"#{method_name}_with_log") do |*args, &block|
          eventlog.lifecycle(message, options) do
            send(:"#{method_name}_without_log", *args, &block)
          end
        end

        alias_method_chain method_name, 'log'
      end
    end

    def eventlog
      Roqua.logger
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
roqua-support-0.1.16 lib/roqua/support/logging.rb
roqua-support-0.1.15 lib/roqua/support/logging.rb
roqua-support-0.1.14 lib/roqua/support/logging.rb
roqua-support-0.1.13 lib/roqua/support/logging.rb
roqua-support-0.1.12 lib/roqua/support/logging.rb
roqua-support-0.1.11 lib/roqua/support/logging.rb
roqua-support-0.1.10 lib/roqua/support/logging.rb
roqua-support-0.1.9 lib/roqua/support/logging.rb
roqua-support-0.1.8 lib/roqua/support/logging.rb
roqua-support-0.1.7 lib/roqua/support/logging.rb
roqua-support-0.1.6 lib/roqua/support/logging.rb
roqua-support-0.1.5 lib/roqua/support/logging.rb
roqua-support-0.1.4 lib/roqua/support/logging.rb
roqua-support-0.1.3 lib/roqua/support/logging.rb
roqua-support-0.1.2.2 lib/roqua/support/logging.rb
roqua-support-0.1.2.1 lib/roqua/support/logging.rb
roqua-support-0.1.2 lib/roqua/support/logging.rb
roqua-support-0.1.1 lib/roqua/support/logging.rb
roqua-support-0.1.0 lib/roqua/support/logging.rb