LogIt++
Loading...
Searching...
No Matches
Logging Macros

A collection of macros for streamlined logging operations. More...

#define LOGIT_FUNCTION   __func__
 
#define LOGIT_ENUM_TO_STR_CASE(value)
 Expands to a case statement returning the stringified enum value.
 
#define LOGIT_LEVEL_TRACE   0
 
#define LOGIT_LEVEL_DEBUG   1
 
#define LOGIT_LEVEL_INFO   2
 
#define LOGIT_LEVEL_WARN   3
 
#define LOGIT_LEVEL_ERROR   4
 
#define LOGIT_LEVEL_FATAL   5
 
#define LOGIT_COMPILED_LEVEL   LOGIT_LEVEL_TRACE
 

Detailed Description

A collection of macros for streamlined logging operations.

This group includes macros for logging messages at various levels, adding loggers, managing log settings, and controlling loggers.

Examples
Basic Logging
LOGIT_INFO("This is an informational message");
LOGIT_WARN("This is a warning message");
LOGIT_ERROR("This is an error message");
#define LOGIT_ERROR(...)
#define LOGIT_INFO(...)
#define LOGIT_WARN(...)
Stream-Based Logging
LOGIT_STREAM_INFO() << "Info level stream logging: value=" << 42;
LOGIT_STREAM_TRACE_TO(2) << "Trace to unique logger at index 2";
#define LOGIT_STREAM_INFO()
Definition LogMacros.hpp:66
#define LOGIT_STREAM_TRACE_TO(index)
Definition LogMacros.hpp:71
Conditional Logging
int x = 42;
LOGIT_DEBUG_IF(x > 0, "x is positive: ", x);
#define LOGIT_DEBUG_IF(condition,...)
Logger Management
LOGIT_SET_LOGGER_ENABLED(1, false); // Disable logger at index 1
LOGIT_INFO("Logger 1 is enabled");
}
#define LOGIT_IS_LOGGER_ENABLED(logger_index)
Checks if a logger is enabled.
#define LOGIT_SET_LOGGER_ENABLED(logger_index, enabled)
Enables or disables a logger.
Task Executor Configuration
Use LOGIT_QUEUE_DROP or LOGIT_QUEUE_BLOCK with LOGIT_SET_QUEUE_POLICY.
LOGIT_SET_MAX_QUEUE(64); // Limit queue size
LOGIT_SET_QUEUE_POLICY(LOGIT_QUEUE_DROP); // Drop tasks when full
#define LOGIT_SET_QUEUE_POLICY(mode)
Sets the behavior when the queue is full.
#define LOGIT_SET_MAX_QUEUE(size)
Sets the maximum number of queued tasks.
#define LOGIT_QUEUE_DROP
Queue policy for dropping tasks when the queue is full.

Macro Definition Documentation

◆ LOGIT_COMPILED_LEVEL

#define LOGIT_COMPILED_LEVEL   LOGIT_LEVEL_TRACE

Definition at line 42 of file LogMacros.hpp.

◆ LOGIT_ENUM_TO_STR_CASE

#define LOGIT_ENUM_TO_STR_CASE ( value)
Value:
case value: return #value;

Expands to a case statement returning the stringified enum value.

Parameters
valueThe enum value.

Definition at line 23 of file LogMacros.hpp.

◆ LOGIT_FUNCTION

#define LOGIT_FUNCTION   __func__

Definition at line 18 of file LogMacros.hpp.

◆ LOGIT_LEVEL_DEBUG

#define LOGIT_LEVEL_DEBUG   1

Definition at line 26 of file LogMacros.hpp.

◆ LOGIT_LEVEL_ERROR

#define LOGIT_LEVEL_ERROR   4

Definition at line 29 of file LogMacros.hpp.

◆ LOGIT_LEVEL_FATAL

#define LOGIT_LEVEL_FATAL   5

Definition at line 30 of file LogMacros.hpp.

◆ LOGIT_LEVEL_INFO

#define LOGIT_LEVEL_INFO   2

Definition at line 27 of file LogMacros.hpp.

◆ LOGIT_LEVEL_TRACE

#define LOGIT_LEVEL_TRACE   0

Definition at line 25 of file LogMacros.hpp.

◆ LOGIT_LEVEL_WARN

#define LOGIT_LEVEL_WARN   3

Definition at line 28 of file LogMacros.hpp.