Timber v2.5.5 Timber.LogEntry

The LogEntry module formalizes the structure of every log entry as defined by Timber’s log event JSON schema: https://github.com/timberio/log-event-json-schema. The ensures log lines adhere to a normalized and consistent structure providing for predictability and reliability for downstream consumers of this log data.

Summary

Types

format()
format() :: :json | :logfmt | :msgpack
m()
m() :: %Timber.LogEntry{context: Timber.Context.m, dt: String.t, event: nil | Timber.Event.m, level: Logger.level, message: binary, meta: nil | Map.t, tags: nil | [String.t], time_ms: nil | float}
t()
t() :: %Timber.LogEntry{context: Timber.Context.t, dt: String.t, event: nil | Timber.Event.t, level: Logger.level, message: iodata, meta: nil | Map.t, tags: nil | [String.t], time_ms: nil | float}

Functions

encode_to_iodata!(log_entry, format, options \\ [])
encode_to_iodata!(t, format, Keyword.t) :: iodata

Encodes the log event to chardata

Options

  • :except - A list of key names. All key names except the ones passed will be encoded.
  • :only - A list of key names. Only the key names passed will be encoded.
new(timestamp, level, message, metadata)
new(LoggerBackend.timestamp, Logger.level, Logger.message, Keyword.t) :: t

Creates a new LogEntry struct

The metadata from Logger is given as the final parameter. If the :timber_context key is present in the metadata, it will be used to fill the context for the log entry. Otherwise, a blank context will be used.

schema()
to_map!(log_entry, options \\ [])
to_map!(t, Keyword.t) :: m