ScoutApm.Logging.LogRecord (scout_apm v2.0.0)

Copy Markdown

Internal struct representing a log record to be sent via OTLP.

Captures all relevant information from an Elixir Logger event and Scout APM context for export to an OTLP collector.

Summary

Functions

Creates a new LogRecord from an Erlang :logger event.

Creates a LogRecord from simple parameters (for testing or direct use).

Types

t()

@type t() :: %ScoutApm.Logging.LogRecord{
  attributes: map(),
  dropped_attributes_count: non_neg_integer(),
  message: String.t(),
  observed_timestamp_nanos: pos_integer(),
  severity: atom(),
  source_location: map() | nil,
  span_id: String.t() | nil,
  timestamp_nanos: pos_integer(),
  trace_id: String.t() | nil
}

Functions

from_logger_event(event, scout_context \\ [])

@spec from_logger_event(
  map(),
  keyword()
) :: t()

Creates a new LogRecord from an Erlang :logger event.

new(severity, message, attributes \\ %{})

@spec new(atom(), String.t(), map()) :: t()

Creates a LogRecord from simple parameters (for testing or direct use).