2017 Ericsson AB. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. logger A logger.xml
logger API module for the logger application.

The severity level for the message to be logged.

Metadata associated with the message to be logged.

Macros

The following macros are defined:

?LOG_EMERGENCY(StringOrReport[,Metadata]) ?LOG_EMERGENCY(FunOrFormat,Args[,Metadata]) ?LOG_ALERT(StringOrReport[,Metadata]) ?LOG_ALERT(FunOrFormat,Args[,Metadata]) ?LOG_CRITICAL(StringOrReport[,Metadata]) ?LOG_CRITICAL(FunOrFormat,Args[,Metadata]) ?LOG_ERROR(StringOrReport[,Metadata]) ?LOG_ERROR(FunOrFormat,Args[,Metadata]) ?LOG_WARNING(StringOrReport[,Metadata]) ?LOG_WARNING(FunOrFormat,Args[,Metadata]) ?LOG_NOTICE(StringOrReport[,Metadata]) ?LOG_NOTICE(FunOrFormat,Args[,Metadata]) ?LOG_INFO(StringOrReport[,Metadata]) ?LOG_INFO(FunOrFormat,Args[,Metadata]) ?LOG_DEBUG(StringOrReport[,Metadata]) ?LOG_DEBUG(FunOrFormat,Args[,Metadata])

All macros expand to a call to logger, where Level is taken from the macro name, and the following metadata is added, or merged with the given Metadata:

#{mfa=>{?MODULE,?FUNCTION_NAME,?FUNCTION_ARITY}, file=>?FILE, line=>?LINE}

The call is wrapped in a case statement and will be evaluated only if Level is equal to or below the configured log level.

emergency(StringOrReport[,Metadata]) emergency(Format,Args[,Metadata]) emergency(Fun,FunArgs[,Metadata]) Logs the given message as level emergency.

Equivalent to log(emergency,...).

alert(StringOrReport[,Metadata]) alert(Format,Args[,Metadata]) alert(Fun,FunArgs[,Metadata]) Logs the given message as level alert.

Equivalent to log(alert,...).

critical(StringOrReport[,Metadata]) critical(Format,Args[,Metadata]) critical(Fun,FunArgs[,Metadata]) Logs the given message as level critical.

Equivalent to log(critical,...).

error(StringOrReport[,Metadata]) error(Format,Args[,Metadata]) error(Fun,FunArgs[,Metadata]) Logs the given message as level error.

Equivalent to log(error,...).

warning(StringOrReport[,Metadata]) warning(Format,Args[,Metadata]) warning(Fun,FunArgs[,Metadata]) Logs the given message as level warning.

Equivalent to log(warning,...).

notice(StringOrReport[,Metadata]) notice(Format,Args[,Metadata]) notice(Fun,FunArgs[,Metadata]) Logs the given message as level notice.

Equivalent to log(notice,...).

info(StringOrReport[,Metadata]) info(Format,Args[,Metadata]) info(Fun,FunArgs[,Metadata]) Logs the given message as level info.

Equivalent to log(info,...).

debug(StringOrReport[,Metadata]) debug(Format,Args[,Metadata]) debug(Fun,FunArgs[,Metadata]) Logs the given message as level debug.

Equivalent to log(debug,...).

Logs the given message.

Log the given message.

Lookup the current configuration for logger.

Lookup the current configuration for logger.

Lookup the current configuration for the given handler.

Lookup the current configuration for the given handler.

Get information about all logger configurations

Same as logger:i(term)

Get information about all logger configurations

The logger:i/1 function can be used to get all current logger configuration. The way that the information is returned depends on the Action

string Return the pretty printed current logger configuration as iodata. term Return the current logger configuration as a term. The format of this term may change inbetween releases. For a stable format use logger:get_handler_config/1 and logger:get_logger_config/0. The same as calling logger:i(). print 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.

Add a filter to the logger.

Add a filter to the specified handler.

Add a filter to the specified handler.

Remove a filter from the logger.

Remove the filter with the specified identity from the logger.

Remove a filter from the specified handler.

Remove the filter with the specified identity from the given handler.

Add a handler with the given configuration.

Add a handler with the given configuration.

Remove the handler with the specified identity.

Remove the handler with the specified identity.

Set the log level for the specified module.

Set the log level for the specified module.

To change the logging level globally, use logger:set_logger_config(level, Level).

Remove a module specific log setting.

Remove a module specific log setting. After this, the global log level is used for the specified module.

Set configuration data for the logger.

Set configuration data for the logger. This overwrites the current logger configuration.

To modify the existing configuration, use set_logger_config/2 , or read the current configuration with get_logger_config/0 , then merge in your added or updated associations before writing it back.

Add or update configuration data for the logger.

Add or update configuration data for the logger. If the given Key already exists, its associated value will be set to Value. If it doesn't exist, it will be added.

Set configuration data for the specified handler.

Set configuration data for the specified handler. This overwrites the current handler configuration.

To modify the existing configuration, use set_handler_config/3 , or read the current configuration with get_handler_config/1 , then merge in your added or updated associations before writing it back.

Add or update configuration data for the specified handler.

Add or update configuration data for the specified handler. If the given Key already exists, its associated value will be set to Value. If it doesn't exist, it will be added.

Compare the severity of two log levels.

Compare the severity of two log levels. Returns gt if Level1 is more severe than Level2, lt if Level1 is less severe, and eq if the levels are equal.

Set metadata to use when logging from current process.

Set metadata which logger automatically inserts in all log events produced on the current process. Subsequent calls will overwrite previous data set by this function.

When logging, location data produced by the log macros, and/or metadata given as argument to the log call (API function or macro), will be merged with the process metadata. If the same keys occur, values from the metadata argument to the log call will overwrite values in the process metadata, which in turn will overwrite values from the location data.

Update metadata to use when logging from current process.

Update metadata to use when logging from 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 set_process_metadata/1 .

Retrieve data set with set_process_metadata/1.

Retrieve data set with set_process_metadata/1.

Delete data set with set_process_metadata/1.

Delete data set with set_process_metadata/1.