Method: Logging::Appenders::IO#initialize

Defined in:
lib/gems/logging-0.9.4/lib/logging/appenders/io.rb

#initialize(name, io, opts = {}) ⇒ IO

call-seq:

IO.new( name, io )
IO.new( name, io, :layout => layout )

Creates a new IO Appender using the given name that will use the io stream as the logging destination.



16
17
18
19
20
21
22
23
24
# File 'lib/gems/logging-0.9.4/lib/logging/appenders/io.rb', line 16

def initialize( name, io, opts = {} )
  unless io.respond_to? :print
    raise TypeError, "expecting an IO object but got '#{io.class.name}'"
  end

  @io = io
  @io.sync = true if @io.respond_to?('sync') rescue nil
  super(name, opts)
end