diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2016-03-03 09:20:00 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-03-04 11:48:04 +0100 |
commit | 4541d83b23f4196a31fae0be3ba84549b9604e28 (patch) | |
tree | cc6b97b7e89c9352a52f998e166cfa80e8317527 /src/nm-logging.h | |
parent | a1dacdbb18004f83b0f73a310a7c4cb4088da1c1 (diff) |
device: improve logging messages
Add a "device" prefix to the messages.
Diffstat (limited to 'src/nm-logging.h')
-rw-r--r-- | src/nm-logging.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/nm-logging.h b/src/nm-logging.h index 97102770c..41b5c1600 100644 --- a/src/nm-logging.h +++ b/src/nm-logging.h @@ -118,30 +118,32 @@ typedef enum { /*< skip >*/ } G_STMT_END -#define _nm_log_ptr(level, domain, self, ...) \ - nm_log ((level), (domain), "[%p] " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), self _NM_UTILS_MACRO_REST(__VA_ARGS__)) +#define _nm_log_ptr(level, domain, self, prefix, ...) \ + nm_log ((level), (domain), "%s[%p] " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), (prefix) ?: "", self _NM_UTILS_MACRO_REST(__VA_ARGS__)) /* log a message for an object (with providing a generic @self pointer) */ -#define nm_log_ptr(level, domain, self, ...) \ +#define nm_log_ptr(level, domain, self, prefix, ...) \ G_STMT_START { \ NM_PRAGMA_WARNING_DISABLE("-Wtautological-compare") \ if ((level) <= LOGL_DEBUG) { \ - _nm_log_ptr ((level), (domain), (self), __VA_ARGS__); \ + _nm_log_ptr ((level), (domain), (self), (prefix), __VA_ARGS__); \ } else { \ - nm_log ((level), (domain), __VA_ARGS__); \ + const char *__prefix = (prefix); \ + \ + nm_log ((level), (domain), "%s%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), __prefix ?: "", __prefix ? " " : "" _NM_UTILS_MACRO_REST(__VA_ARGS__)); \ } \ NM_PRAGMA_WARNING_REENABLE \ } G_STMT_END -#define _nm_log_obj(level, domain, self, ...) \ - _nm_log_ptr ((level), (domain), (self), __VA_ARGS__) +#define _nm_log_obj(level, domain, self, prefix, ...) \ + _nm_log_ptr ((level), (domain), (self), prefix, __VA_ARGS__) /* log a message for an object (with providing a @self pointer to a GObject). * Contrary to nm_log_ptr(), @self must be a GObject type (or %NULL). * As of now, nm_log_obj() is identical to nm_log_ptr(), but we might change that */ -#define nm_log_obj(level, domain, self, ...) \ - nm_log_ptr ((level), (domain), (self), __VA_ARGS__) +#define nm_log_obj(level, domain, self, prefix, ...) \ + nm_log_ptr ((level), (domain), (self), prefix, __VA_ARGS__) void _nm_log_impl (const char *file, |