Class: SemanticLogger::Formatters::Fluentd
- Defined in:
- lib/semantic_logger/formatters/fluentd.rb
Overview
Fluentd is similar to SemanticLogger::Formatters::Json but with log levels that are recognized by kubernetes fluentd.
Instance Attribute Summary collapse
-
#need_process_info ⇒ Object
readonly
Returns the value of attribute need_process_info.
Attributes inherited from Raw
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(time_format: :rfc_3339, time_key: :time, need_process_info: false, **args) ⇒ Fluentd
constructor
A new instance of Fluentd.
- #level ⇒ Object
- #process_info ⇒ Object
Methods inherited from Json
Methods inherited from Raw
#application, #call, #duration, #environment, #exception, #file_name_and_line, #host, #message, #metric, #name, #named_tags, #payload, #pid, #tags, #thread_name, #time
Methods inherited from Base
#backtrace, #fast_tag, #level=, #log, #measure, #named_tags, #pop_tags, #push_tags, #should_log?, #silence, #tagged, #tags
Constructor Details
#initialize(time_format: :rfc_3339, time_key: :time, need_process_info: false, **args) ⇒ Fluentd
Returns a new instance of Fluentd.
10 11 12 13 |
# File 'lib/semantic_logger/formatters/fluentd.rb', line 10 def initialize(time_format: :rfc_3339, time_key: :time, need_process_info: false, **args) @need_process_info = need_process_info super(time_format: time_format, time_key: time_key, **args) end |
Instance Attribute Details
#need_process_info ⇒ Object (readonly)
Returns the value of attribute need_process_info.
8 9 10 |
# File 'lib/semantic_logger/formatters/fluentd.rb', line 8 def need_process_info @need_process_info end |
Instance Method Details
#level ⇒ Object
15 16 17 18 |
# File 'lib/semantic_logger/formatters/fluentd.rb', line 15 def level hash["severity"] = log.level hash["severity_index"] = log.level_index end |
#process_info ⇒ Object
20 21 22 23 |
# File 'lib/semantic_logger/formatters/fluentd.rb', line 20 def process_info # Ignore fields: pid, thread, file and line by default super() if need_process_info end |