class Bauxite::Loggers::CompositeLogger
Composite logger.
This composite logger forwards logging calls to each of its children.
Composite logger options include:
loggers
-
A comma-separated list of logger names.
Public Class Methods
new(options, loggers = nil)
click to toggle source
Constructs a new composite logger instance.
# File lib/bauxite/loggers/composite.rb, line 33 def initialize(options, loggers = nil) unless loggers unless options[:loggers] raise ArgumentError, "Missing required logger option 'loggers'. "+ "The value of this option is a comma-separated list of valid loggers. "+ "For example loggers=xterm,file." end loggers = options[:loggers].split(',') end @loggers = loggers.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 62 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 81 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 75 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 54 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 67 def progress(value) @loggers.each { |l| l.progress(value) } end