Class: StructuredEventLogger::JsonWriter
- Inherits:
-
Object
- Object
- StructuredEventLogger::JsonWriter
- Defined in:
- lib/structured_event_logger/json_writer.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
- #call(scope, event, hash, record) ⇒ Object
-
#initialize(io) ⇒ JsonWriter
constructor
A new instance of JsonWriter.
Constructor Details
#initialize(io) ⇒ JsonWriter
Returns a new instance of JsonWriter.
8 9 10 |
# File 'lib/structured_event_logger/json_writer.rb', line 8 def initialize(io) @io = io end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
6 7 8 |
# File 'lib/structured_event_logger/json_writer.rb', line 6 def io @io end |
Instance Method Details
#call(scope, event, hash, record) ⇒ Object
12 13 14 |
# File 'lib/structured_event_logger/json_writer.rb', line 12 def call(scope, event, hash, record) io.write(MultiJson.encode(record) + "\n") end |