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)
-
- (LogHub) initialize(*loggers)
constructor
Takes a list of instances or classes (which will be initialized) and that are added to @loggers.
-
- (Object) log(tag, *args)
Integration to Logging.
Methods included from Ramaze::Logging
#debug, #debug?, #dev, #error, #info, #shutdown, #tag_log, #warn
Constructor Details
- (LogHub) initialize(*loggers)
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
- (Object) ignored_tags
14 15 16 |
# File 'lib/ramaze/log/hub.rb', line 14 def @ignored_tags end |
- (Object) loggers
13 14 15 |
# File 'lib/ramaze/log/hub.rb', line 13 def loggers @loggers end |
Instance Method Details
- (Object) log(tag, *args)
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 |