View Source LoggerJSON.Formatter behaviour (logger_json v5.1.4)

Behaviour that should be implemented by log formatters.

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

Summary

Callbacks

Initialization callback. Ran on startup with the given formatter_opts list.

Callbacks

Link to this callback

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

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

Format event callback.

Returned map will be encoded to JSON.

@callback init(Keyword.t()) :: term()

Initialization callback. Ran on startup with the given formatter_opts list.

Returned list will be used as formatter_state in format_event/6.