Class: Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_logger_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Logger

Returns a new instance of Logger.



3
4
5
# File 'lib/ruby_logger_adapter.rb', line 3

def initialize(*args)
  @logger = ::Slf4r::LoggerFacade.new(:root)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



23
24
25
# File 'lib/ruby_logger_adapter.rb', line 23

def method_missing(method, *args, &block)
  @logger.send(method, *args, &block) if @logger.respond_to?(method)
end

Instance Method Details

#debug(msg, &block) ⇒ Object



7
8
9
# File 'lib/ruby_logger_adapter.rb', line 7

def debug(msg, &block)
  @logger.debug(msg, &block)
end

#error(msg, &block) ⇒ Object



19
20
21
# File 'lib/ruby_logger_adapter.rb', line 19

def error(msg, &block)
  @logger.error(msg, &block)
end

#info(msg, &block) ⇒ Object



11
12
13
# File 'lib/ruby_logger_adapter.rb', line 11

def info(msg, &block)
  @logger.info(msg, &block)
end

#respend_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/ruby_logger_adapter.rb', line 27

def respend_to?(method)
  @logger.respond_to?(method)
end

#warn(msg, &block) ⇒ Object



15
16
17
# File 'lib/ruby_logger_adapter.rb', line 15

def warn(msg, &block)
  @logger.warn(msg, &block)
end