View Source LogfmtEx.Encoder (logfmt_ex v0.4.2)

Encodes key=value pairs in logfmt.

Quotes values containing spaces and =. For example,

Logger.info("I am a message with spaces", string: "key=value")

will be encoded as

message="I am a message with spaces" string="key=value"

Escapes newlines, line breaks, backslashes, and carriage returns.

Link to this section Summary

Types

Metadata keys are atoms. Message, timestamp, and level keys are strings.

Functions

Encodes the given key and value into a key=value pair. Returns iodata/0, an efficient data type for creating large binaries from small chunks.

Link to this section Types

@type key() :: String.t() | atom()

Metadata keys are atoms. Message, timestamp, and level keys are strings.

Link to this section Functions

Link to this function

encode(key, value, opts \\ [])

View Source
@spec encode(key(), term(), keyword()) :: iodata()

Encodes the given key and value into a key=value pair. Returns iodata/0, an efficient data type for creating large binaries from small chunks.

A subset of keys from standard Elixir metadata are handled in special ways:

options

Options:

  • :delimiter - defaults to =