Class: Log4r::IOOutputter
- Defined in:
- lib/log4r-color/outputter/iooutputter.rb
Overview
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.
Direct Known Subclasses
ColorOutputter, FileOutputter, StderrOutputter, StdoutOutputter
Instance Attribute Summary
Attributes inherited from Outputter
#colors, #formatter, #level, #name
Instance Method Summary collapse
-
#close ⇒ Object
Close the IO and sets level to OFF.
- #closed? ⇒ Boolean
-
#initialize(_name, _out, hash = {}) ⇒ IOOutputter
constructor
IOOutputter needs an IO object to write to.
Methods inherited from Outputter
[], []=, color, each, each_outputter, #flush, #level_key, #only_at, stderr, stdout
Constructor Details
#initialize(_name, _out, hash = {}) ⇒ IOOutputter
IOOutputter needs an IO object to write to.
18 19 20 21 |
# File 'lib/log4r-color/outputter/iooutputter.rb', line 18 def initialize(_name, _out, hash={}) super(_name, hash) @out = _out end |
Instance Method Details
#close ⇒ Object
Close the IO and sets level to OFF
28 29 30 31 32 33 |
# File 'lib/log4r-color/outputter/iooutputter.rb', line 28 def close @out.close unless @out.nil? @level = OFF OutputterFactory.create_methods(self) Logger.log_internal {"Outputter '#{@name}' closed IO and set to OFF"} end |
#closed? ⇒ Boolean
23 24 25 |
# File 'lib/log4r-color/outputter/iooutputter.rb', line 23 def closed? @out.closed? end |