Timber v2.8.1 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.t, dt: String.t, event: nil | Timber.Event.t, level: Logger.level, message: binary, meta: nil | map, 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, 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.

Creates a new LogEntry struct

This function will merge the global context from Timber.GlobalContext with any context present in the :timber_metadata key in the metadata parameter.

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