The severity level for the message to be logged.
Metadata for the log event.
Logger adds the following metadata to each log event:
When a log macro is used, Logger also inserts location information:
You can add custom metadata, either by specifying a map as
the last parameter to any of the log macros or the API
functions, or by setting process metadata
with
Logger merges all the metadata maps before forwarding the log event to the handlers. If the same keys occur, values from the log call overwrites process metadata, which in turn overwrites values set by Logger.
Configuration data for the logger part of Logger, or for a handler.
The following default values apply:
See the
A unique identifier for a handler instance.
A unique identifier for a filter.
A filter which can be installed for logger or for a handler.
The second argument to the filter fun.
The return value from the filter fun.
A timestamp produced
with
The following macros are defined:
All macros expand to a call to logger, where
The call is wrapped in a case statement and will be evaluated
only if
Equivalent to
Equivalent to
Equivalent to
Equivalent to
Equivalent to
Equivalent to
Equivalent to
Equivalent to
Log the given message.
Lookup the current configuration for logger.
Lookup the current configuration for the given handler.
Same as
Display or return all current logger configuration.
Return the pretty printed current logger configuration as iodata.
Return the current logger configuration as a term. The
format of this term may change inbetween releases. For a
stable format use
Pretty print all the current logger configuration to standard out. Example:
logger:i(print).
Current logger configuration:
Level: info
FilterDefault: log
Filters:
Handlers:
Id: logger_std_h
Module: logger_std_h
Level: info
Formatter:
Module: logger_formatter
Config: #{template => [{logger_formatter,header},"\n",msg,"\n"],
legacy_header => true}
Filter Default: stop
Filters:
Id: stop_progress
Fun: fun logger_filters:progress/2
Config: stop
Id: remote_gl
Fun: fun logger_filters:remote_gl/2
Config: stop
Id: domain
Fun: fun logger_filters:domain/2
Config: {log,prefix_of,[beam,erlang,otp,sasl]}
Id: no_domain
Fun: fun logger_filters:domain/2
Config: {log,no_domain,[]}
Handler Config:
logger_std_h: #{type => standard_io}
Level set per module:
Module: my_module
Level: debug]]>
Add a filter to the logger.
The filter fun is called with the log event as the first
parameter, and the specified
The return value of the fun specifies if a log event is to be discarded or forwarded to the handlers:
The filter passed. The next logger filter, if any, is applied. If no more logger filters exist, the log event is forwarded to the handler part of the logger, where handler filters are applied.
The filter did not pass, and the log event is immediately discarded.
The filter has no knowledge of the log event. The next
logger filter, if any, is applied. If no more logger
filters exist, the value of the
See section
Some built-in filters exist. These are defined
in
Add a filter to the specified handler.
The filter fun is called with the log event as the first
parameter, and the specified
The return value of the fun specifies if a log event is to be discarded or forwarded to the handler callback:
The filter passed. The next handler filter, if any, is applied. If no more filters exist for this handler, the log event is forwarded to the handler callback.
The filter did not pass, and the log event is immediately discarded.
The filter has no knowledge of the log event. The next
handler filter, if any, is applied. If no more filters
exist for this handler, the value of
the
See
section
Some built-in filters exist. These are defined in
Remove the filter identified
by
Remove the filter identified
by
Add a handler with the given configuration.
Remove the handler identified by
Set the log level for the
specified
The log level for a module overrides the global log level of the logger for log event originating from the module in question. Notice, however, that it does not override the level configuration for any handler.
For example: Assume that the global log level for the
logger is
With this configuration, no debug messages will be logged, since they are all stopped by the global log level.
If the level for
Debug events from other modules are still not logged.
To change the global log level for the logger, use
To change the log level for a handler, use
The originating module for a log event is only detected
if
Remove a module specific log setting. After this, the global log level is used for the specified module.
Set configuration data for the logger. This overwrites the current logger configuration.
To modify the existing configuration,
use
If a key is removed compared to the current configuration, the default value is used.
Add or update configuration data for the logger. If the
given
Set configuration data for the specified handler. This overwrites the current handler configuration.
To modify the existing configuration,
use
If a key is removed compared to the current configuration, and the key is know by Logger, the default value is used. If it is a custom key, then it is up to the handler implementation if the value is removed or a default value is inserted.
Add or update configuration data for the specified
handler. If the given
Compare the severity of two log levels. Returns
Set metadata which Logger shall automatically insert in all log events produced on the current process.
Location data produced by the log macros, and/or metadata given as argument to the log call (API function or macro), are merged with the process metadata. If the same keys occur, values from the metadata argument to the log call overwrite values from the process metadata, which in turn overwrite values from the location data.
Subsequent calls to this function overwrites previous data
set. To update existing data instead of overwriting it,
see
Set or update metadata to use when logging from current process
If process metadata exists for the current process, this function behaves as if it was implemented as follows:
logger:set_process_metadata(maps:merge(logger:get_process_metadata(),Meta))
If no process metadata exists, the function behaves as
Retrieve data set
with
Delete data set
with
Convert a log message on report form to
This is the default report callback used
by
The function produces lines of
If the
The following functions are to be exported from a handler callback module.
This callback function is optional.
The function is called when an new handler is about to be added, and the purpose is to verify the configuration and initiate all resourced needed by the handler.
If everything succeeds, the callback function can add
possible default values or internal state values to the
configuration, and return the adjusted map
in
If the configuration is faulty, or if the initiation fails,
the callback function must return
This callback function is optional.
The function is called when a handler is about to be removed, and the purpose is to release all resources used by the handler. The return value is ignored by Logger.
This callback function is optional.
The function is called when the configuration for a handler is about to change, and the purpose is to verify and act on the new configuration.
If everything succeeds, the callback function must return a
possibly adjusted configuration in
If the configuration is faulty, the callback function must
return