Timber v2.5.4 Timber.LogEntry View Source

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.

Link to this section Summary

Link to this section Types

Link to this type format() View Source
format() :: :json | :logfmt | :msgpack
Link to this type m() View Source
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}
Link to this type t() View Source
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}

Link to this section Functions

Link to this function encode_to_iodata!(log_entry, format, options \\ []) View Source
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.
Link to this function new(timestamp, level, message, metadata) View Source
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.

Link to this function to_map!(log_entry, options \\ []) View Source
to_map!(t, Keyword.t) :: m