Class: Rack::TrafficLogger::Formatter::Stream

Inherits:
Rack::TrafficLogger::Formatter show all
Defined in:
lib/rack/traffic_logger/formatter/stream.rb

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Stream

Returns a new instance of Stream.



8
9
10
# File 'lib/rack/traffic_logger/formatter/stream.rb', line 8

def initialize(**options)
  @simulator = StreamSimulator.new(**options)
end

Instance Method Details

#format(hash) ⇒ Object



12
13
14
15
# File 'lib/rack/traffic_logger/formatter/stream.rb', line 12

def format(hash)
  time = Time.parse(hash['timestamp'])
  "@ #{time.strftime '%a %d %b \'%y %T.%3N'} ##{hash['request_log_id']}\n#{@simulator.format(hash)}\n\n"
end