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.



7
8
9
# File 'lib/structured_event_logger/json_writer.rb', line 7

def initialize(io)
  @io = io
end

Instance Attribute Details

#ioObject (readonly)

Returns the value of attribute io.



5
6
7
# File 'lib/structured_event_logger/json_writer.rb', line 5

def io
  @io
end

Instance Method Details

#call(scope, event, hash, record) ⇒ Object



11
12
13
# File 'lib/structured_event_logger/json_writer.rb', line 11

def call(scope, event, hash, record)
  io.write(ActiveSupport::JSON.encode(record) + "\n")
end