Configures logging from the [log] config section.
Logs go to standard output through the VM's default :logger handler,
or, when directory is set, to rotating files written by
Sovite.Core.Logging.FileHandler. With syslog, they also go to the
syslog daemon (Sovite.Core.Logging.SyslogHandler), instead of to
standard output.
Every log line about a message carries its queue ID in the :queue_id
metadata key, so one message's lifecycle can be followed with grep.
metadata_keys/0 lists the standard keys. See docs/logging.md.
Summary
Functions
Returns the child specs that write logs to files and to syslog, or
[] when logging to standard output only.
Applies the log level and format to the default handler.
Formats an IP address for the :remote_ip metadata key. The text
formatter skips tuples, so addresses are logged as strings.
Returns the :logger formatter for format.
Metadata keys included in every log format.
Types
@type config() :: %{ level: :debug | :info | :notice | :warning | :error, format: :text | :json, directory: Path.t() | nil, file_name: String.t(), date_format: String.t(), max_size: pos_integer(), rotation: Sovite.Core.Logging.FileHandler.rotation(), max_files: non_neg_integer(), symlink: String.t() | nil, syslog: boolean(), syslog_address: {:unix, Path.t()} | {:udp, String.t() | :inet.ip_address(), 1..65535}, syslog_facility: atom(), syslog_format: :rfc3164 | :rfc5424 }
Functions
@spec child_specs(config()) :: [Supervisor.module_spec()]
Returns the child specs that write logs to files and to syslog, or
[] when logging to standard output only.
These handlers silence the default handler while they run, so lines are not written twice.
@spec configure(config()) :: :ok
Applies the log level and format to the default handler.
@spec format_ip(:inet.ip_address() | nil) :: String.t() | nil
Formats an IP address for the :remote_ip metadata key. The text
formatter skips tuples, so addresses are logged as strings.
Returns the :logger formatter for format.
For :text, opts are passed to Logger.Formatter.new/1.
@spec metadata_keys() :: [atom()]
Metadata keys included in every log format.