Class: Kanal::Core::Logging::CompositeLogger
- Inherits:
-
Logger
- Object
- Logger
- Kanal::Core::Logging::CompositeLogger
- Defined in:
- lib/kanal/core/logging/composite_logger.rb
Overview
Object of this class us used to store and use several loggers. It inherits from standard Logger and overrides it’s methods for accepting messages for every possible log level. Calling #debug (or any other loglevel) on this object results in calling #debug for every logger that it stores.
Instance Method Summary collapse
- #add_logger(logger) ⇒ Object
- #debug(message) ⇒ Object
- #error(message) ⇒ Object
- #fatal(message) ⇒ Object
- #info(message) ⇒ Object
-
#initialize ⇒ CompositeLogger
constructor
Property allowed_methods defines which methods can be called.
- #unknown(message) ⇒ Object
- #warn(message) ⇒ Object
Constructor Details
#initialize ⇒ CompositeLogger
Property allowed_methods defines which methods can be called. These methods mirror standard Logger methods.
16 17 18 |
# File 'lib/kanal/core/logging/composite_logger.rb', line 16 def initialize @loggers = [] end |
Instance Method Details
#add_logger(logger) ⇒ Object
20 21 22 |
# File 'lib/kanal/core/logging/composite_logger.rb', line 20 def add_logger(logger) @loggers << logger end |
#debug(message) ⇒ Object
24 25 26 |
# File 'lib/kanal/core/logging/composite_logger.rb', line 24 def debug() :debug, caller_class_name(caller.first), end |
#error(message) ⇒ Object
36 37 38 |
# File 'lib/kanal/core/logging/composite_logger.rb', line 36 def error() :error, caller_class_name(caller.first), end |
#fatal(message) ⇒ Object
40 41 42 |
# File 'lib/kanal/core/logging/composite_logger.rb', line 40 def fatal() :fatal, caller_class_name(caller.first), end |
#info(message) ⇒ Object
28 29 30 |
# File 'lib/kanal/core/logging/composite_logger.rb', line 28 def info() :info, caller_class_name(caller.first), end |
#unknown(message) ⇒ Object
44 45 46 |
# File 'lib/kanal/core/logging/composite_logger.rb', line 44 def unknown() :unknown, caller_class_name(caller.first), end |
#warn(message) ⇒ Object
32 33 34 |
# File 'lib/kanal/core/logging/composite_logger.rb', line 32 def warn() :warn, caller_class_name(caller.first), end |