diff options
| author | Michael Biebl <biebl@debian.org> | 2015-05-05 17:48:57 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2015-05-05 17:48:57 +0200 |
| commit | f408e27bccfacf347605a8d98649975a68f38a17 (patch) | |
| tree | 654fd6695c31511baf919b1c0870d119a352ed75 /src/nm-logging.h | |
| parent | 2c032d8f1c6292c1338a615e6ec40252889ba85c (diff) | |
Imported Upstream version 1.0.2 upstream/1.0.2
Diffstat (limited to 'src/nm-logging.h')
| -rw-r--r-- | src/nm-logging.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/nm-logging.h b/src/nm-logging.h index 4ab2db3a..00d429b0 100644 --- a/src/nm-logging.h +++ b/src/nm-logging.h @@ -100,12 +100,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 (__FILE__, __LINE__, G_STRFUNC, (level), (domain), __VA_ARGS__); \ + _nm_log (level, domain, 0, __VA_ARGS__); \ } \ } G_STMT_END @@ -116,11 +124,13 @@ typedef enum { /*< skip >*/ /* log a message for an object (with providing a generic @self pointer) */ #define nm_log_ptr(level, domain, self, ...) \ G_STMT_START { \ + NM_PRAGMA_WARNING_DISABLE("-Wtautological-compare") \ if ((level) <= LOGL_DEBUG) { \ _nm_log_ptr ((level), (domain), (self), __VA_ARGS__); \ } else { \ nm_log ((level), (domain), __VA_ARGS__); \ } \ + NM_PRAGMA_WARNING_REENABLE \ } G_STMT_END @@ -134,13 +144,14 @@ typedef enum { /*< skip >*/ nm_log_ptr ((level), (domain), (self), __VA_ARGS__) -void _nm_log (const char *file, - guint line, - const char *func, - NMLogLevel level, - NMLogDomain domain, - const char *fmt, - ...) __attribute__((__format__ (__printf__, 6, 7))); +void _nm_log_impl (const char *file, + guint line, + const char *func, + NMLogLevel level, + NMLogDomain domain, + int error, + const char *fmt, + ...) __attribute__((__format__ (__printf__, 7, 8))); const char *nm_logging_level_to_string (void); const char *nm_logging_domains_to_string (void); |