View Source LogfmtEx (logfmt_ex v0.1.1)

Formats logs in logfmt format.

This module allows developers to specify a list of atoms that serves as template for log messages, for example:

[:timestamp, :level, :message, :metadata]

Will print an error message as:

  timestamp="18:43:12 2022-5-22" level=error message="oh no spaghettio" user_id=13

The valid parameters you can use are:

  • :timestamp - the time and date the log message was sent
  • :message - the log message
  • :level - the log level
  • :node - the node that printed the message
  • :metadata - the metadata attached to the log

Link to this section Summary

Link to this section Types

@type pattern() :: [pattern_keys()]
@type pattern_keys() :: :timestamp | :level | :message | :metadata | :node
@type time() :: {{1970..10000, 1..12, 1..31}, {0..23, 0..59, 0..59, 0..99}}

Link to this section Functions

Link to this function

format(level, message, arg, metadata)

View Source
@spec format(Logger.level(), any(), Logger.Formatter.time(), Keyword.t()) :: iodata()
Link to this function

format(level, message, arg, metadata, opts)

View Source
@spec format(Logger.level(), any(), Logger.Formatter.time(), Keyword.t(), Keyword.t()) ::
  iodata()