Class: StructuredEventLogger::JsonWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/structured_event_logger/json_writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#ioObject (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