ExJsonLogger (ex_json_logger v1.3.0) View Source

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.

Link to this section Summary

Functions

Function referenced in the :format config.

Link to this section Functions

Link to this function

format(level, msg, timestamp, metadata)

View Source

Specs

Function referenced in the :format config.