Class: Intake::IOSink
Overview
Sink that writes log events to IO stream, e.g., STDOUT or file stream
Instance Attribute Summary collapse
-
#exception_formatter ⇒ Object
Returns the value of attribute exception_formatter.
-
#formatter ⇒ Object
Returns the value of attribute formatter.
Instance Method Summary collapse
- #drain(event) ⇒ Object
-
#initialize(io) ⇒ IOSink
constructor
A new instance of IOSink.
Methods inherited from Sink
Constructor Details
Instance Attribute Details
#exception_formatter ⇒ Object
Returns the value of attribute exception_formatter.
17 18 19 |
# File 'lib/intake/io_sink.rb', line 17 def exception_formatter @exception_formatter end |
#formatter ⇒ Object
Returns the value of attribute formatter.
17 18 19 |
# File 'lib/intake/io_sink.rb', line 17 def formatter @formatter end |
Instance Method Details
#drain(event) ⇒ Object
19 20 21 22 23 |
# File 'lib/intake/io_sink.rb', line 19 def drain(event) = "\n#{@exception_formatter.call(event[:error])}" unless event[:error].nil? txt = "#{@formatter.call(event)}#{}\n" @io.write(txt) end |