Class: GEPA::Logging::CompositeLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/gepa/logging/logger.rb

Overview

Logger that fans out messages to multiple IO streams.

Instance Method Summary collapse

Constructor Details

#initialize(*ios) ⇒ CompositeLogger

Returns a new instance of CompositeLogger.



31
32
33
# File 'lib/gepa/logging/logger.rb', line 31

def initialize(*ios)
  @ios = ios.flatten
end

Instance Method Details

#log(message) ⇒ Object



35
36
37
38
39
40
# File 'lib/gepa/logging/logger.rb', line 35

def log(message)
  @ios.each do |io|
    io.puts(message)
    io.flush if io.respond_to?(:flush)
  end
end