View Source ExJsonLogger (ex_json_logger v1.4.0)

A Logger formatter that converts logs to single line JSON.

Logging additional information

Use Logger's metadata to add additional data to the log output. This can be done through Logger.metadata/1 or by passing Keywords to standard Logger calls in the optional second parameter. Logger filters metadata so any additional keys will need to be whitelisted in the backend's configuration.

Usage

config :logger, :console,
  format: {ExJsonLogger, :format},
  metadata: [
    :request_id,
    :additional_key
  ]

Currently tested with the :console logger backend.

Summary

Functions

Function referenced in the :format config.

Functions

Link to this function

format(level, msg, timestamp, metadata)

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

Function referenced in the :format config.