Logging#

2026-03-31

2 min read time

Applies to Linux

Logging utilities for UCXX. Provides macros and functions for diagnostic output at various log levels.

#include <ucxx/log.h>

namespace ucxx

Defines

UCXX_MAX_LOG_LEVEL#
ucxx_log_component_is_enabled(_level, _comp_log_config)#
ucxx_log_is_enabled(_level)#
ucxx_log_component(_level, _comp_log_config, _fmt, ...)#
ucxx_log(_level, _fmt, ...)#
ucxx_error(_fmt, ...)#
ucxx_warn(_fmt, ...)#
ucxx_diag(_fmt, ...)#
ucxx_info(_fmt, ...)#
ucxx_debug(_fmt, ...)#
ucxx_trace(_fmt, ...)#
ucxx_trace_req(_fmt, ...)#
ucxx_trace_data(_fmt, ...)#
ucxx_trace_async(_fmt, ...)#
ucxx_trace_func(_fmt, ...)#
ucxx_trace_poll(_fmt, ...)#
namespace ucxx

Functions

void parseLogLevel(
)#

Parse the active log level.

Parse the active log level and set appropriate internal values to match the specified level.

Variables

ucs_log_component_config_t ucxx_log_component_config#

The UCXX log level component configuration.

The type with the UCXX log level component configuration.

const std::unordered_map<std::string, ucxx_log_level_t> logLevelNames = {{"FATAL", UCXX_LOG_LEVEL_FATAL}, {"ERROR", UCXX_LOG_LEVEL_ERROR}, {"WARN", UCXX_LOG_LEVEL_WARN}, {"DIAG", UCXX_LOG_LEVEL_DIAG}, {"INFO", UCXX_LOG_LEVEL_INFO}, {"DEBUG", UCXX_LOG_LEVEL_DEBUG}, {"TRACE", UCXX_LOG_LEVEL_TRACE}, {"REQ", UCXX_LOG_LEVEL_TRACE_REQ}, {"DATA", UCXX_LOG_LEVEL_TRACE_DATA}, {"ASYNC", UCXX_LOG_LEVEL_TRACE_ASYNC}, {"FUNC", UCXX_LOG_LEVEL_TRACE_FUNC}, {"POLL", UCXX_LOG_LEVEL_TRACE_POLL}, {"", UCXX_LOG_LEVEL_LAST}, {"PRINT", UCXX_LOG_LEVEL_PRINT}}#

Map of log level names to their respective types.

Map of log level names, used by the user to specify levels to enable, to their respective internal types.

const char logLevelNameDefault[] = "WARN"#

The name of the default log level.

The name of default log level, must be one of the keys in logLevelNames.

const ucs_log_level_t logLevelDefault = (ucs_log_level_t)logLevelNames.at(logLevelNameDefault)#

The type of the default log level.

The type of default log level, automatically set based on the value of logLevelNameDefault.