Class: LogSinks::Formatter
- Inherits:
-
Object
- Object
- LogSinks::Formatter
- Defined in:
- lib/log_sinks/formatter.rb
Overview
Base class that serializes event to data format acceptable by sink (usually it’s [String])
Instance Method Summary collapse
- #call(event) ⇒ Object
-
#initialize ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize ⇒ Formatter
Returns a new instance of Formatter.
6 7 8 |
# File 'lib/log_sinks/formatter.rb', line 6 def initialize @timestamp_format = '%Y-%m-%dT%H:%M:%S.%6N' end |
Instance Method Details
#call(event) ⇒ Object
10 11 12 13 14 |
# File 'lib/log_sinks/formatter.rb', line 10 def call(event) # rubocop:disable Layout/LineLength "#{event.level.to_s[0]}, [#{event..strftime(@timestamp_format)} ##{Process.pid}] #{event.level} -- #{event[:progname]}: #{event.}\n" # rubocop:enable Layout/LineLength end |