class Stump::LoggerTargets

LoggerTargets gets passed to the Logger.rb instantiate method as its logdevice. Thus whenever write is called for the logger, the write method defined below is called. This method loops through the predefined targets (usually a file and STDOUT) and writes to them. flush is necessary due to the fact that write is a buffered method.

Public Class Methods

new(*targets) click to toggle source
# File lib/stump/logger_targets.rb, line 11
def initialize(*targets)
  @targets = targets
end

Public Instance Methods

close() click to toggle source
# File lib/stump/logger_targets.rb, line 22
def close
  @targets.each(&:close)
end
write(*args) click to toggle source
# File lib/stump/logger_targets.rb, line 15
def write(*args)
  @targets.each do |t|
    t.write(*args)
    t.flush
  end
end