Module: CallLogger

Defined in:
lib/call_logger.rb,
lib/call_logger/logger.rb,
lib/call_logger/version.rb,
lib/call_logger/formatter.rb,
lib/call_logger/call_logger.rb,
lib/call_logger/configuration.rb

Defined Under Namespace

Modules: ClassMethods Classes: Configuration, Formatter, Logger, MethodWrapper

Constant Summary collapse

VERSION =
"0.2.0"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



14
15
16
# File 'lib/call_logger.rb', line 14

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



17
18
19
20
# File 'lib/call_logger.rb', line 17

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration) if block_given?
end

.included(base) ⇒ Object



9
10
11
# File 'lib/call_logger.rb', line 9

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#log(method, args, &block) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/call_logger.rb', line 23

def log(method, args, &block)
  logger = ::CallLogger.configuration.logger
  formatter = ::CallLogger.configuration.formatter
  method_wrapper = ::CallLogger::MethodWrapper.new(
    logger: logger, formatter: formatter
  )
  method_wrapper.call(method, args, &block)
end