Class: IRuby::MultiLogger

Inherits:
BasicObject
Defined in:
lib/iruby/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*loggers, level: ::Logger::DEBUG) ⇒ MultiLogger

Returns a new instance of MultiLogger.



9
10
11
12
# File 'lib/iruby/logger.rb', line 9

def initialize(*loggers, level: ::Logger::DEBUG)
  @loggers = loggers
  @level = level
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &b) ⇒ Object



25
26
27
# File 'lib/iruby/logger.rb', line 25

def method_missing(name, *args, &b)
  @loggers.map {|x| x.respond_to?(name) && x.public_send(name, *args, &b) }.any?
end

Instance Attribute Details

#levelObject

Returns the value of attribute level.



16
17
18
# File 'lib/iruby/logger.rb', line 16

def level
  @level
end

#loggersObject (readonly)

Returns the value of attribute loggers.



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

def loggers
  @loggers
end