Class: IRuby::MultiLogger
- Inherits:
- BasicObject
- Defined in:
- lib/iruby/logger.rb
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
-
#loggers ⇒ Object
readonly
Returns the value of attribute loggers.
Instance Method Summary collapse
-
#initialize(*loggers, level: ::Logger::DEBUG) ⇒ MultiLogger
constructor
A new instance of MultiLogger.
- #method_missing(name, *args, &b) ⇒ Object
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
#level ⇒ Object
Returns the value of attribute level.
16 17 18 |
# File 'lib/iruby/logger.rb', line 16 def level @level end |
#loggers ⇒ Object (readonly)
Returns the value of attribute loggers.
14 15 16 |
# File 'lib/iruby/logger.rb', line 14 def loggers @loggers end |