Log Levels
Table of Contents
PSR Log Levels
The logging module defines the following log levels (severities), from PSR-3: Logger Interface - (In accordance with RFC 5424).
Psr Log Level | Description |
---|---|
EMERGENCY_LEVEL |
System is unusable. |
ALERT_LEVEL |
Action must be taken immediately. |
CRITICAL_LEVEL |
Critical conditions. |
ERROR_LEVEL |
Error conditions. |
WARNING_LEVEL |
Warning conditions. |
NOTICE_LEVEL |
Normal but significant condition. |
INFO_LEVEL |
Informational messages. |
DEBUG_LEVEL |
Debug-level messages. |
CMake Message Modes
All the PSR log levels are associated with the following cmake message modes. This means that cmake’s current log level is respected, when using any of the logging functions that are offered by this module.
Psr Log Level | CMake Message Mode | Mode Description |
---|---|---|
EMERGENCY_LEVEL |
FATAL_ERROR |
CMake Error, stops processing and generation. |
ALERT_LEVEL |
FATAL_ERROR |
CMake Error, stops processing and generation. |
CRITICAL_LEVEL |
FATAL_ERROR |
CMake Error, stops processing and generation. |
ERROR_LEVEL |
SEND_ERROR |
CMake Error, continues processing, but skips generation. |
WARNING_LEVEL |
WARNING |
CMake Warning, continues processing. |
NOTICE_LEVEL |
NOTICE |
Important message printed to stderr. |
INFO_LEVEL |
NOTICE |
Important message printed to stderr. |
DEBUG_LEVEL |
DEBUG |
Detailed informational messages intended for developers. |
Customize
To change the default PSR log level / cmake message mode association, set the RSP_LOG_LEVELS_CMAKE
list property,
before you include the rsp/logging
module
or by force caching the property.
Use the following format for associating the levels:
"<psr> <cmake_mode>"
<psr>
: PSR log level name.<cmake_mode>
: cmake’s message modes.
set(RSP_LOG_LEVELS_CMAKE
"${EMERGENCY_LEVEL} FATAL_ERROR"
"${ALERT_LEVEL} FATAL_ERROR"
"${CRITICAL_LEVEL} FATAL_ERROR"
"${ERROR_LEVEL} FATAL_ERROR"
"${WARNING_LEVEL} WARNING"
"${NOTICE_LEVEL} NOTICE"
"${INFO_LEVEL} STATUS"
"${DEBUG_LEVEL} STATUS"
CACHE STRING "Log levels / message mode"
)