LoggerJSON.Formatter behaviour (logger_json v4.3.0) View Source

Behaviour that should be implemented by log formatters.

Example implementations can be found in LoggerJSON.Formatters.GoogleCloudLogger and LoggerJSON.Formatters.BasicLogger.

Link to this section Summary

Link to this section Callbacks

Link to this callback

format_event(level, msg, ts, md, state)

View Source

Specs

format_event(
  level :: Logger.level(),
  msg :: Logger.message(),
  ts :: Logger.Formatter.time(),
  md :: [atom()] | :all,
  state :: map()
) :: map() | iodata() | %Jason.Fragment{encode: term()}

Format event callback.

Returned map will be encoded to JSON.