#include <kanzi/core/log/default_logger.hpp>
#include <kanzi/core/log/log_category.hpp>
#include <kanzi/core/log/log_level.hpp>
#include <kanzi/core/log/log_record.hpp>
#include <kanzi/core/log/log_specialization.hpp>
Macros | |
#define | kzLog(logger, level, category, message) |
To use custom logger to write log messages, use kzLog macro. More... | |
#define | kzLogError(category, message) |
To write error log messages with the Default Logger, use kzLogError macro. More... | |
#define | kzLogWarning(category, message) |
To write warning log messages with the Default Logger, use kzLogWarning macro. More... | |
#define | kzLogInfo(category, message) |
To write info log messages with the Default Logger, use kzLogInfo macro. More... | |
#define | kzLogTrace(category, message) |
To write trace log messages with the Default Logger, use kzLogTrace macro. More... | |
#define | kzLogDebug(message) |
To write debug log messages with the Default Logger, use kzLogDebug macro. More... | |
The Logging subsystem is responsible for writing messages to the log. Use Logging macros provided by the subsystem for writing the log messages. You can use the log level and the log category to filter the log messages at compile-time. See Message classification and filtering. You can write scalar values as well as formatted messages to the log. For log message format description refer to Log message formating.
Use the log level to classify the messages based on the severity of the information they contain. For example, you can use the error log level (KZ_LOG_LEVEL_ERROR) to log critical problems which occured during the application execution, while you can use the info log level (KZ_LOG_LEVEL_INFO) to log normal application activity. For more information about the log levels, see Log Level.
Use the log category to group messages that contain information about the same functionality. For example, you can create the "Engine" log category to log messages related to the rendering engine activity, while you can group messages related to KZB file loading in the "kzb loading" log category. For detailed information on how to create log categories, see Log category.
The log message filtering is implemented in Logging macros. Kanzi filters the log messages at compile-time using the log level and the log category that you assign to these messages. The preprocessor removes the call to the logging macro, if you disable the log level or the log category, assigned to the message in that macro call. Otherwise, the macro is replaced with the code that writes message to the log. To learn how to enable/disabled the log level and the log category, see Log Level and Log category.
Shows how you can filter log messages:
Shows the danger of using application critical code in a call to the logging macro: