Class: SemanticLogger::Formatters::OpenTelemetry

Inherits:
Raw
  • Object
show all
Defined in:
lib/semantic_logger/formatters/open_telemetry.rb

Instance Attribute Summary

Attributes inherited from Raw

#hash, #time_key

Attributes inherited from Base

#filter, #name

Instance Method Summary collapse

Methods inherited from Raw

#application, #call, #duration, #environment, #exception, #file_name_and_line, #host, #initialize, #message, #metric, #name, #named_tags, #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

This class inherits a constructor from SemanticLogger::Formatters::Raw

Instance Method Details

#levelObject

Log level



6
7
8
9
# File 'lib/semantic_logger/formatters/open_telemetry.rb', line 6

def level
  hash[:level]       = log.level.to_s
  hash[:level_index] = severity_number(log.level_index)
end

#payloadObject

Payload is submitted directly as attributes



12
13
14
15
16
# File 'lib/semantic_logger/formatters/open_telemetry.rb', line 12

def payload
  return unless log.payload.respond_to?(:empty?) && !log.payload.empty?

  hash[:payload] = log.payload.transform_keys!(&:to_s)
end