Class: SemanticLogger::Formatters::Json
- Defined in:
- lib/semantic_logger/formatters/json.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Raw
Attributes inherited from Base
Instance Method Summary collapse
-
#call(log, logger) ⇒ Object
Returns log messages in JSON format.
-
#initialize(time_format: :iso_8601, time_key: :timestamp, **args) ⇒ Json
constructor
Default JSON time format is ISO8601.
Methods inherited from Raw
#application, #duration, #environment, #exception, #file_name_and_line, #host, #level, #message, #metric, #name, #named_tags, #payload, #pid, #tags, #thread_name, #time
Methods inherited from Base
#backtrace, #fast_tag, #level, #level=, #log, #measure, #named_tags, #pop_tags, #push_tags, #should_log?, #silence, #tagged, #tags
Constructor Details
#initialize(time_format: :iso_8601, time_key: :timestamp, **args) ⇒ Json
Default JSON time format is ISO8601
6 7 8 |
# File 'lib/semantic_logger/formatters/json.rb', line 6 def initialize(time_format: :iso_8601, time_key: :timestamp, **args) super(time_format: time_format, time_key: time_key, **args) end |
Instance Method Details
#call(log, logger) ⇒ Object
Returns log messages in JSON format
11 12 13 |
# File 'lib/semantic_logger/formatters/json.rb', line 11 def call(log, logger) super(log, logger).to_json end |