Class: SplitLogger
- Inherits:
-
Object
- Object
- SplitLogger
- Defined in:
- lib/split_logger/split_logger.rb
Instance Attribute Summary collapse
-
#logger_list ⇒ Object
Returns the value of attribute logger_list.
Instance Method Summary collapse
- #add(name, logger) ⇒ Object
-
#initialize(loggers = {}) ⇒ SplitLogger
constructor
A new instance of SplitLogger.
- #list ⇒ Object
- #remove(name) ⇒ Object
Constructor Details
#initialize(loggers = {}) ⇒ SplitLogger
Returns a new instance of SplitLogger.
5 6 7 8 9 10 11 12 13 |
# File 'lib/split_logger/split_logger.rb', line 5 def initialize(loggers = {}) self.logger_list = {} loggers.each do |name, logger| self.add(name, logger) end if defined?(RAILS_DEFAULT_LOGGER) self.add(:rails_default_logger, RAILS_DEFAULT_LOGGER) end end |
Instance Attribute Details
#logger_list ⇒ Object
Returns the value of attribute logger_list.
3 4 5 |
# File 'lib/split_logger/split_logger.rb', line 3 def logger_list @logger_list end |
Instance Method Details
#add(name, logger) ⇒ Object
15 16 17 |
# File 'lib/split_logger/split_logger.rb', line 15 def add(name, logger) self.logger_list[name.to_sym] = logger end |
#list ⇒ Object
26 27 28 |
# File 'lib/split_logger/split_logger.rb', line 26 def list self.logger_list end |
#remove(name) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/split_logger/split_logger.rb', line 19 def remove(name) name = name.to_sym if self.logger_list.has_key?(name) self.logger_list.delete(name) end end |