Commit c6cbd652 authored by Thomas Haller's avatar Thomas Haller

active-connection: add logging macros _LOG*()

parent 1928c2f8
......@@ -104,6 +104,46 @@ static void _device_cleanup (NMActiveConnection *self);
/****************************************************************/
#define _LOG_DOMAIN LOGD_DEVICE
#define _LOG_PREFIX_NAME "active-connection"
#define _LOG(level, domain, self, ...) \
G_STMT_START { \
const NMLogLevel __level = (level); \
const NMLogDomain __domain = (domain); \
\
if (nm_logging_enabled (__level, __domain)) { \
char __prefix[128]; \
const char *__p_prefix = _LOG_PREFIX_NAME; \
const void *const __self = (self); \
\
if (__self) { \
g_snprintf (__prefix, sizeof (__prefix), "%s[%p]", _LOG_PREFIX_NAME, __self); \
__p_prefix = __prefix; \
} \
_nm_log (__level, __domain, 0, \
"%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
__p_prefix _NM_UTILS_MACRO_REST (__VA_ARGS__)); \
} \
} G_STMT_END
#define _LOG_LEVEL_ENABLED(level, domain) \
( nm_logging_enabled ((level), (domain)) )
#ifdef NM_MORE_LOGGING
#define _LOGT_ENABLED() _LOG_LEVEL_ENABLED (LOGL_TRACE, _LOG_DOMAIN)
#define _LOGT(...) _LOG (LOGL_TRACE, _LOG_DOMAIN, self, __VA_ARGS__)
#else
#define _LOGT_ENABLED() FALSE
#define _LOGT(...) G_STMT_START { if (FALSE) { _LOG (LOGL_TRACE, _LOG_DOMAIN, self, __VA_ARGS__); } } G_STMT_END
#endif
#define _LOGD(...) _LOG (LOGL_DEBUG, _LOG_DOMAIN, self, __VA_ARGS__)
#define _LOGI(...) _LOG (LOGL_INFO , _LOG_DOMAIN, self, __VA_ARGS__)
#define _LOGW(...) _LOG (LOGL_WARN , _LOG_DOMAIN, self, __VA_ARGS__)
#define _LOGE(...) _LOG (LOGL_ERR , _LOG_DOMAIN, self, __VA_ARGS__)
/****************************************************************/
static const char *
state_to_string (NMActiveConnectionState state)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment