Creates a new IO Appender using the given name that will use the io stream as the logging destination.
# File lib/logging/appenders/io.rb, line 23 def initialize( name, io, opts = {} ) unless io.respond_to? :syswrite raise TypeError, "expecting an IO object but got '#{io.class.name}'" end @io = io @io.sync = true if io.respond_to? :sync= # syswrite complains if the IO stream is buffered @close_method = :close super(name, opts) configure_buffering(opts) end
Close the appender and writes the layout footer to the logging destination if the footer flag is set to true. Log events will no longer be written to the logging destination after the appender is closed.
# File lib/logging/appenders/io.rb, line 44 def close( *args ) return self if @io.nil? super io, @io = @io, nil unless [STDIN, STDERR, STDOUT].include?(io) io.send(@close_method) if @close_method and io.respond_to? @close_method end rescue IOError ensure return self end
Generated with the Darkfish Rdoc Generator 2.