Class: SplitLogger
- Inherits:
-
Object
- Object
- SplitLogger
- Defined in:
- lib/split_logger/version.rb,
lib/split_logger/split_logger.rb
Constant Summary collapse
- VERSION =
"2.0.0"
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
-
#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.
6 7 8 9 10 11 12 13 14 |
# File 'lib/split_logger/split_logger.rb', line 6 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
#level ⇒ Object
Returns the value of attribute level.
4 5 6 |
# File 'lib/split_logger/split_logger.rb', line 4 def level @level end |
#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
16 17 18 |
# File 'lib/split_logger/split_logger.rb', line 16 def add(name, logger) self.logger_list[name.to_sym] = logger end |
#list ⇒ Object
27 28 29 |
# File 'lib/split_logger/split_logger.rb', line 27 def list self.logger_list end |
#remove(name) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/split_logger/split_logger.rb', line 20 def remove(name) name = name.to_sym if self.logger_list.has_key?(name) self.logger_list.delete(name) end end |