C Collections

clogger · Section 3

clog_set_level

clog_set_level - change the minimum log level at runtime

C Collections (libccollections, -lccollections)

#include <ccollections/clogger.h>
 
ccol_retval clog_set_level(clog logger, clog_level level);

Sets the minimum severity level, and a later call whose level is
strictly below the new minimum is silently discarded.  The change takes
effect at once and every thread that shares the logger sees it.

logger  Logger handle.
level   New minimum level (CLOG_TRACE through CLOG_OFF).
        CLOG_OFF suppresses all output except CLOG_FATAL.
        A value that clog_level does not name, such as -3 or
        12, is refused and the level stays as it is.

ccol_success       The minimum level is set.
ccol_invalid_args  clog_level does not name level.  The level stays
                   as it is.

CLOG_FATAL skips this filter completely and is always written, whatever
the minimum level is.
A log call that runs on another thread at the same time as this call
can get either the old minimum or the new one.  On an async logger, a
record that is already in the queue when the change takes effect is
written.
Thread-safe.  Each logger keeps its minimum level in an atomic value of
its own, apart from the lock that serialises the writes and the rotation
of the shared output target, so changing the level of one logger never
contends with a write that a sibling logger on the same target has in
progress.
Asserts when logger is CLOG_NULL, stale or already closed.

clog_get_level(3), clog_create_from_fd_mp(3), clog_create_from_file_path_mp(3)