summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/devices/nm-device-logging.h2
-rw-r--r--src/devices/nm-device.c10
-rw-r--r--src/nm-logging.h20
3 files changed, 17 insertions, 15 deletions
diff --git a/src/devices/nm-device-logging.h b/src/devices/nm-device-logging.h
index 6255d6f381..8a2c9b681c 100644
--- a/src/devices/nm-device-logging.h
+++ b/src/devices/nm-device-logging.h
@@ -34,7 +34,7 @@ _nm_device_log_self_to_device (t *self) \
#undef _NMLOG_ENABLED
#define _NMLOG_ENABLED(level, domain) ( nm_logging_enabled ((level), (domain)) )
#define _NMLOG(level, domain, ...) \
- nm_log_obj ((level), (domain), (self), \
+ nm_log_obj ((level), (domain), (self), "device", \
"(%s): " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
(self) ? str_if_set (nm_device_get_iface (_nm_device_log_self_to_device (self)), "(null)") : "(none)" \
_NM_UTILS_MACRO_REST(__VA_ARGS__))
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index c062e88f81..4502cf5d3b 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3164,7 +3164,7 @@ recheck_available (gpointer user_data)
}
if (new_state > NM_DEVICE_STATE_UNKNOWN) {
- _LOGD (LOGD_DEVICE, "device is %savailable, %s %s",
+ _LOGD (LOGD_DEVICE, "is %savailable, %s %s",
now_available ? "" : "not ",
new_state == NM_DEVICE_STATE_UNAVAILABLE ? "no change required for" : "will transition to",
state_to_string (new_state == NM_DEVICE_STATE_UNAVAILABLE ? state : new_state));
@@ -8434,7 +8434,7 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
- _LOGD (LOGD_HW, "bringing up device.");
+ _LOGD (LOGD_HW, "bringing up device");
if (NM_DEVICE_GET_CLASS (self)->bring_up) {
if (!NM_DEVICE_GET_CLASS (self)->bring_up (self, no_firmware))
@@ -8508,7 +8508,7 @@ nm_device_take_down (NMDevice *self, gboolean block)
g_return_if_fail (NM_IS_DEVICE (self));
- _LOGD (LOGD_HW, "taking down device.");
+ _LOGD (LOGD_HW, "taking down device");
if (NM_DEVICE_GET_CLASS (self)->take_down) {
if (!NM_DEVICE_GET_CLASS (self)->take_down (self))
@@ -10355,7 +10355,7 @@ _set_state_full (NMDevice *self,
if ( (priv->state == state)
&& ( state != NM_DEVICE_STATE_UNAVAILABLE
|| !priv->firmware_missing)) {
- _LOGD (LOGD_DEVICE, "device state change: %s -> %s (reason '%s') [%d %d %d]%s",
+ _LOGD (LOGD_DEVICE, "state change: %s -> %s (reason '%s') [%d %d %d]%s",
state_to_string (old_state),
state_to_string (state),
reason_to_string (reason),
@@ -10366,7 +10366,7 @@ _set_state_full (NMDevice *self,
return;
}
- _LOGI (LOGD_DEVICE, "device state change: %s -> %s (reason '%s') [%d %d %d]",
+ _LOGI (LOGD_DEVICE, "state change: %s -> %s (reason '%s') [%d %d %d]",
state_to_string (old_state),
state_to_string (state),
reason_to_string (reason),
diff --git a/src/nm-logging.h b/src/nm-logging.h
index 97102770c5..41b5c16007 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,