KasperskyOS Community Edition 1.3
ClogLog() function and CLOG macro

The ClogLog() function writes to the log.

The ClogLog() function is intended for use in C-language programs. In C++ programs, use the Logger::Log() function or LOG_* macros.

A description of the ClogLog() function and macros for quick access to it are provided in the file /opt/KasperskyOS-Community-Edition-<version>/sysroot-*-kos/include/component/logrr/clog/clog.h.

component/logrr/clog/clog.h (fragment)

__attribute__((format(printf, 6, 7))) void ClogLog(const char *module, LogLevel level, const char *file, int line, const char *func, const char *message, ...); #define CLOG_TRACE_IMPL_EX(level, file, line, func, ...) \ ClogLog(LOG_MODULE, level, file, line, func, __VA_ARGS__) #define CLOG_TRACE_IMPL(level, ...) \ CLOG_TRACE_IMPL_EX((level), \ __FILENAME__, \ __LINE__, \ __func__, \ __VA_ARGS__) #define __CLOG_LEVEL_TRACE__ LogrrLogLevel_Trace #define __CLOG_LEVEL_DEBUG__ LogrrLogLevel_Debug #define __CLOG_LEVEL_INFO__ LogrrLogLevel_Info #define __CLOG_LEVEL_WARNING__ LogrrLogLevel_Warning #define __CLOG_LEVEL_ERROR__ LogrrLogLevel_Error #define __CLOG_LEVEL_CRITICAL__ LogrrLogLevel_Critical #define CLOG(level, ...) CLOG_TRACE_IMPL(__CLOG_LEVEL_ ## level ## __, __VA_ARGS__)

Parameters of the ClogLog() function:

level
Log level LogrrLogLevel.
file
File name.
line
Number of the line in the file.
func
Function name.
message
Message text or message text formatting string.
...
Parameters to be inserted into the message formatting string.

Macro for quick access to the ClogLog() function

Instead of calling the ClogLog() function, you can use the macro whose description is provided in the file component/logrr/clog/clog.h. This macros is variadic (takes a variable number of parameters), which lets you avoid specifying all parameters of the ClogLog() function. When calling this macro, you only need to specify the log level and message text or the message formatting string with the values of parameters. The applied log level is determined by the first parameter of the macro. An example of using this macro is provided in the section titled Using macros to send messages to a log.