logging: add logging macro _nm_log() that logs unconditionally

This commit is contained in:
Thomas Haller 2015-04-22 11:11:44 +02:00
parent 211d241ab0
commit fb9f8c69f7

View file

@ -99,12 +99,20 @@ typedef enum { /*< skip >*/
#define nm_log_dbg(domain, ...) nm_log (LOGL_DEBUG, (domain), __VA_ARGS__)
#define nm_log_trace(domain, ...) nm_log (LOGL_TRACE, (domain), __VA_ARGS__)
/* A wrapper for the _nm_log_impl() function that adds call site information.
* Contrary to nm_log(), it unconditionally calls the function without
* checking whether logging for the given level and domain is enabled. */
#define _nm_log(level, domain, error, ...) \
G_STMT_START { \
_nm_log_impl (__FILE__, __LINE__, G_STRFUNC, (level), (domain), (error), ""__VA_ARGS__); \
} G_STMT_END
/* nm_log() only evaluates it's argument list after checking
* whether logging for the given level/domain is enabled. */
#define nm_log(level, domain, ...) \
G_STMT_START { \
if (nm_logging_enabled ((level), (domain))) { \
_nm_log_impl (__FILE__, __LINE__, G_STRFUNC, (level), (domain), 0, ""__VA_ARGS__); \
_nm_log (level, domain, 0, __VA_ARGS__); \
} \
} G_STMT_END