Behaviour contract for custom Arrea Engine loggers.
Implementing this behaviour allows projects to provide their own
logger formatter that integrates with Elixir's :logger infrastructure
while maintaining full control over formatting and output style.
Usage
defmodule MyApp.Logger do
@behaviour Arrea.Logging.Behaviour
@impl true
def log(:info, message, metadata) do
IO.puts("[INFO] #{message}")
end
@impl true
def format(level, message, metadata) do
"#{DateTime.utc_now()} [#{level}] #{message}"
end
endConfiguration
# config/config.exs
config :arrea, :logger_formatter, MyApp.Logger
Summary
Callbacks
Formats a log message into a string.
Logs a message at the given level.
Returns the minimum log level this logger handles.
Types
@type level() ::
:debug | :info | :notice | :warning | :error | :critical | :alert | :emergency
@type metadata() :: keyword()
Callbacks
Formats a log message into a string.
Used by handlers that need a formatted string rather than direct output. The returned string should NOT include a trailing newline.
Logs a message at the given level.
Called by the Arrea logging handler for each log event that passes the configured level threshold.
@callback min_level() :: level()
Returns the minimum log level this logger handles.
Events below this level will be silently dropped.