Log4r::IOOutputter

IO Outputter invokes print then flush on the wrapped IO object. If the IO stream dies, IOOutputter sets itself to OFF and the system continues on its merry way.

To find out why an IO stream died, create a logger named ‘log4r’ and look at the output.

Public Class Methods

new(_name, _out, hash={}) click to toggle source

IOOutputter needs an IO object to write to.

    # File lib/log4r/outputter/iooutputter.rb, line 18
18:     def initialize(_name, _out, hash={})
19:       super(_name, hash)
20:       @out = _out
21:     end

Public Instance Methods

close() click to toggle source

Close the IO and sets level to OFF

    # File lib/log4r/outputter/iooutputter.rb, line 28
28:     def close
29:       @out.close unless @out.nil?
30:       @level = OFF
31:       OutputterFactory.create_methods(self)
32:       Logger.log_internal {"Outputter '#{@name}' closed IO and set to OFF"}
33:     end
closed?() click to toggle source
    # File lib/log4r/outputter/iooutputter.rb, line 23
23:     def closed?
24:       @out.closed?
25:     end

Private Instance Methods

write(data) click to toggle source

perform the write

    # File lib/log4r/outputter/iooutputter.rb, line 40
40:     def write(data)
41:       begin
42:         @out.print data
43:         @out.flush
44:       rescue IOError => ioe # recover from this instead of crash
45:         Logger.log_internal {"IOError in Outputter '#{@name}'!"}
46:         Logger.log_internal {ioe}
47:         close
48:       rescue NameError => ne
49:         Logger.log_internal {"Outputter '#{@name}' IO is #{@out.class}!"}
50:         Logger.log_internal {ne}
51:         close
52:       end
53:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.