quill
quill copied to clipboard
Add QUILL_SHOULD_LOG macro
Currently, to conditionally do some processing before logging, you do it like this:
if (logger->should_log(LogLevel::TraceL1)) {
... // do some processing
LOG_TRACE_L1(logger, ...);
}
If QUILL_ACTIVE_LOG_LEVEL
is set to QUILL_LOG_LEVEL_DEBUG
or higher, the LOG_TRACE_L1
will not be compiled in, but the remaining code will be. It seems like there should be a macro instead such that the code above becomes:
if (QUILL_SHOULD_LOG(logger, LogLevel::TraceL1)) {
... // do some processing
LOG_TRACE_L1(logger, ...);
}
The macro would just evaluate to false
when QUILL_ACTIVE_LOG_LEVEL
is set to QUILL_LOG_LEVEL_DEBUG
or higher.