Class: Ramaze::Logger::LogHub
- Inherits:
-
Object
- Object
- Ramaze::Logger::LogHub
- Includes:
- Ramaze::Logging
- Defined in:
- lib/ramaze/log/hub.rb
Overview
Bundles different informer instances and sends incoming messages to each. This is the default with Informer as only member.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(*loggers) ⇒ LogHub
constructor
Takes a list of instances or classes (which will be initialized) and that are added to @loggers.
-
#log(tag, *args) ⇒ Object
Integration to Logging.
Methods included from Ramaze::Logging
#debug, #debug?, #dev, #error, #info, #shutdown, #tag_log, #warn
Constructor Details
#initialize(*loggers) ⇒ LogHub
Takes a list of instances or classes (which will be initialized) and that are added to @loggers. All messages are then sent to each member.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ramaze/log/hub.rb', line 22 def initialize(*loggers) @loggers = loggers @ignored_tags = Set.new @loggers.map! do |logger| next(nil) if logger == self logger.is_a?(Class) ? logger.new : logger end @loggers.uniq! @loggers.compact! end |
Instance Attribute Details
#ignored_tags ⇒ Object
14 15 16 |
# File 'lib/ramaze/log/hub.rb', line 14 def @ignored_tags end |
#loggers ⇒ Object
13 14 15 |
# File 'lib/ramaze/log/hub.rb', line 13 def loggers @loggers end |
Instance Method Details
#log(tag, *args) ⇒ Object
Integration to Logging
39 40 41 42 43 44 |
# File 'lib/ramaze/log/hub.rb', line 39 def log(tag, *args) return if @ignored_tags.include?(tag) @loggers.each do |logger| logger.log(tag, *args) end end |