class Bauxite::Loggers::CompositeLogger
Composite logger.
This composite logger forwards logging calls to each of its children.
Set the :loggers
option to a comma-separated list of logger
names
Public Class Methods
new(options)
click to toggle source
Constructs a new composite logger instance.
# File lib/bauxite/loggers/composite.rb, line 32 def initialize(options) @loggers = options[:loggers].split(',').map do |l| Bauxite::Context::load_logger(l, options) end end
Public Instance Methods
debug_prompt()
click to toggle source
Returns a colorized debug prompt.
This implementation returns the #debug_prompt of the first logger.
# File lib/bauxite/loggers/composite.rb, line 52 def debug_prompt @loggers[0].debug_prompt end
finalize(ctx)
click to toggle source
Completes the log execution.
# File lib/bauxite/loggers/composite.rb, line 71 def finalize(ctx) @loggers.each { |l| l.finalize(ctx) } end
log(s, type = :info)
click to toggle source
Prints the specified string.
See Bauxite::Loggers::NullLogger#print
# File lib/bauxite/loggers/composite.rb, line 65 def log(s, type = :info) @loggers.each { |l| l.log(s, type) } end
log_cmd(action, &block)
click to toggle source
Pretty prints action information and status.
This implementation only yileds in the first logger.
Additional loggers are called after the block completed.
# File lib/bauxite/loggers/composite.rb, line 44 def log_cmd(action, &block) _log_cmd_block(@loggers, action, &block) end
progress(value)
click to toggle source
Updates action progress.
# File lib/bauxite/loggers/composite.rb, line 57 def progress(value) @loggers.each { |l| l.progress(value) } end