Using macros to send messages to a log

The LogRR program provides macros for quickly accessing logging functions with a specific log level.

Example use of macros in a C-language program:

C

#include <component/logrr/clog/clog.h>

// ...

CLOG(CRITICAL, "Critical message. Exit code = %d", 404);

CLOG(ERROR, "Error message. Error code = %d", 13);

CLOG(WARNING, "Warning message. Details: %s", "operation not permitted.");

CLOG(INFO, "Info message. Status: %s", "connected.");

CLOG(DEBUG, "Debug message.");

CLOG(TRACE, "Trace message.");

To use these macros, you need to link the program to the logrr_clog library.

Example use of macros in a C++ program:

C++

#include <component/logrr/cpp/logger.h>

// ...

LOG(CRITICAL, "Critical message. Exit code = {}", 404);

LOG(ERROR, "Error message. Error code = {}", 13);

LOG(WARNING, "Warning message. Details: {}", "operation not permitted.");

LOG(INFO, "Info message. Status: {}", "connected.");

LOG(DEBUG, "Debug message.");

LOG(TRACE, "Trace message.");

To use these macros, you need to link the program to the logrr_cpp library.

See also:

Advanced capabilities when sending messages to a log

Page top