summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-04-22 11:11:44 +0200
committerThomas Haller <thaller@redhat.com>2015-04-22 11:22:19 +0200
commitfb9f8c69f7c665b9e1ed4358a5bc41548263b0fa (patch)
tree6a3d72a98bc969bb5de2a8e0d776647cfb329584
parent211d241ab081361341f4eeb05d7175993bde514c (diff)
downloadNetworkManager-fb9f8c69f7c665b9e1ed4358a5bc41548263b0fa.tar.gz
logging: add logging macro _nm_log() that logs unconditionally
-rw-r--r--src/nm-logging.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nm-logging.h b/src/nm-logging.h
index 0d15f9fc7a..be453a20b7 100644
--- a/src/nm-logging.h
+++ b/src/nm-logging.h
@@ -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