Class: Datadog::Core::Telemetry::Event::Log
- Defined in:
- lib/datadog/core/telemetry/event.rb
Overview
Telemetry class for the ‘logs’ event
Constant Summary collapse
- LEVELS =
{ error: 'ERROR', warn: 'WARN', }.freeze
Instance Method Summary collapse
-
#initialize(message:, level:, stack_trace: nil) ⇒ Log
constructor
A new instance of Log.
- #payload ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(message:, level:, stack_trace: nil) ⇒ Log
Returns a new instance of Log.
351 352 353 354 355 356 |
# File 'lib/datadog/core/telemetry/event.rb', line 351 def initialize(message:, level:, stack_trace: nil) super() @message = @stack_trace = stack_trace @level = LEVELS.fetch(level) { |k| raise ArgumentError, "Invalid log level :#{k}" } end |
Instance Method Details
#payload ⇒ Object
358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/datadog/core/telemetry/event.rb', line 358 def payload { logs: [ { message: @message, level: @level, stack_trace: @stack_trace, }.compact ] } end |
#type ⇒ Object
347 348 349 |
# File 'lib/datadog/core/telemetry/event.rb', line 347 def type 'logs' end |