Class: BBK::Utils::CombinedLogger
- Inherits:
-
Object
- Object
- BBK::Utils::CombinedLogger
- Includes:
- Logger::Severity
- Defined in:
- lib/bbk/utils/combined_logger.rb
Instance Attribute Summary collapse
-
#formatter ⇒ Object
Returns the value of attribute formatter.
-
#level ⇒ Object
(also: #sev_threshold)
Returns the value of attribute level.
-
#loggers ⇒ Object
readonly
Returns the value of attribute loggers.
-
#progname ⇒ Object
Returns the value of attribute progname.
Class Method Summary collapse
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(progname, *loggers, formatter: LogFormatter.new, level: Logger::Severity::INFO) ⇒ CombinedLogger
constructor
A new instance of CombinedLogger.
- #method_missing(name, *args, **kwargs, &block) ⇒ Object
Constructor Details
#initialize(progname, *loggers, formatter: LogFormatter.new, level: Logger::Severity::INFO) ⇒ CombinedLogger
Returns a new instance of CombinedLogger.
17 18 19 20 21 22 |
# File 'lib/bbk/utils/combined_logger.rb', line 17 def initialize(progname, *loggers, formatter: LogFormatter.new, level: Logger::Severity::INFO) @loggers = loggers self.progname = progname self.level = level self.formatter = formatter end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, **kwargs, &block) ⇒ Object
63 64 65 66 |
# File 'lib/bbk/utils/combined_logger.rb', line 63 def method_missing(name, *args, **kwargs, &block) @loggers.each {|logger| logger.send(name, *args, **kwargs, &block)} nil end |
Instance Attribute Details
#formatter ⇒ Object
Returns the value of attribute formatter.
11 12 13 |
# File 'lib/bbk/utils/combined_logger.rb', line 11 def formatter @formatter end |
#level ⇒ Object Also known as: sev_threshold
Returns the value of attribute level.
11 12 13 |
# File 'lib/bbk/utils/combined_logger.rb', line 11 def level @level end |
#loggers ⇒ Object (readonly)
Returns the value of attribute loggers.
11 12 13 |
# File 'lib/bbk/utils/combined_logger.rb', line 11 def loggers @loggers end |
#progname ⇒ Object
Returns the value of attribute progname.
11 12 13 |
# File 'lib/bbk/utils/combined_logger.rb', line 11 def progname @progname end |
Class Method Details
.new(*args, **kwargs) ⇒ Object
13 14 15 |
# File 'lib/bbk/utils/combined_logger.rb', line 13 def self.new(*args, **kwargs) ActiveSupport::TaggedLogging.new(super) end |
Instance Method Details
#clone ⇒ Object
68 69 70 71 72 |
# File 'lib/bbk/utils/combined_logger.rb', line 68 def clone super.tap do |it| it.instance_variable_set(:@loggers, loggers.map(&:clone)) end end |