summary refs log tree commit diff
path: root/src/nm-logging.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-08-28 01:13:48 +0200
committerMichael Biebl <biebl@debian.org>2015-08-28 01:13:48 +0200
commit81836c2d44802b4cca833d7775dd627e0797a7e2 (patch)
tree91154e6cefc0465306603f51ec0010d9963bbea4 /src/nm-logging.h
parent50a58f0fabd8a34c1b6108a107e08abe3c1ccd24 (diff)
Imported Upstream version 1.0.6 upstream/1.0.6
Diffstat (limited to 'src/nm-logging.h')
-rw-r--r--src/nm-logging.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/nm-logging.h b/src/nm-logging.h
index 82a4e71f..40218062 100644
--- a/src/nm-logging.h
+++ b/src/nm-logging.h
@@ -167,4 +167,35 @@ gboolean nm_logging_setup (const char  *level,
 void     nm_logging_syslog_openlog   (gboolean debug);
 void     nm_logging_syslog_closelog  (void);
 
+/*****************************************************************************/
+
+/* This is the default definition of _NMLOG_ENABLED(). Special implementations
+ * might want to undef this and redefine it. */
+#define _NMLOG_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG_DOMAIN)) )
+
+#define _LOGt(...)          _NMLOG (LOGL_TRACE, __VA_ARGS__)
+#define _LOGD(...)          _NMLOG (LOGL_DEBUG, __VA_ARGS__)
+#define _LOGI(...)          _NMLOG (LOGL_INFO , __VA_ARGS__)
+#define _LOGW(...)          _NMLOG (LOGL_WARN , __VA_ARGS__)
+#define _LOGE(...)          _NMLOG (LOGL_ERR  , __VA_ARGS__)
+
+#define _LOGt_ENABLED(...)  _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
+#define _LOGD_ENABLED(...)  _NMLOG_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
+#define _LOGI_ENABLED(...)  _NMLOG_ENABLED (LOGL_INFO , ##__VA_ARGS__)
+#define _LOGW_ENABLED(...)  _NMLOG_ENABLED (LOGL_WARN , ##__VA_ARGS__)
+#define _LOGE_ENABLED(...)  _NMLOG_ENABLED (LOGL_ERR  , ##__VA_ARGS__)
+
+/* _LOGt() and _LOGT() both log with level TRACE, but the latter is disabled by default,
+ * unless building with --with-more-logging. */
+#ifdef NM_MORE_LOGGING
+#define _LOGT_ENABLED(...)  _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
+#define _LOGT(...)          _NMLOG (LOGL_TRACE, __VA_ARGS__)
+#else
+/* still call the logging macros to get compile time checks, but they will be optimize out. */
+#define _LOGT_ENABLED(...)  ( FALSE && (_NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
+#define _LOGT(...)          G_STMT_START { if (FALSE) { _NMLOG (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
+#endif
+
+/*****************************************************************************/
+
 #endif /* __NETWORKMANAGER_LOGGING_H__ */