Class: Rack::TrafficLogger::Formatter::Stream
- Inherits:
-
Rack::TrafficLogger::Formatter
- Object
- Rack::TrafficLogger::Formatter
- Rack::TrafficLogger::Formatter::Stream
- Defined in:
- lib/rack/traffic_logger/formatter/stream.rb
Instance Method Summary collapse
- #format(hash) ⇒ Object
-
#initialize(**options) ⇒ Stream
constructor
A new instance of Stream.
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(**) @simulator = StreamSimulator.new(**) 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 |