summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-11-11 22:26:00 +0100
committerThomas Haller <thaller@redhat.com>2014-11-11 22:40:25 +0100
commit900763ce0f3613890ae265969d34163c3c8f43db (patch)
tree21dbe5b6435950022b4ce5087f78784e1063da2e
parent142dbf213e536e34759bd3f2371289dc6c1d54cb (diff)
downloadNetworkManager-900763ce0f3613890ae265969d34163c3c8f43db.tar.gz
dhcp: fix adapter for sd logging macros to show file location
Previously we were logging: <debug> [1415715440.639086] [__FILE__:__LINE__] client_set_lease_timeouts(): DHCP CLIENT (0xcf221f86): T1 expires in 11h 59min 53.566147s Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--src/dhcp-manager/systemd-dhcp/nm-sd-adapt.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dhcp-manager/systemd-dhcp/nm-sd-adapt.h b/src/dhcp-manager/systemd-dhcp/nm-sd-adapt.h
index 2823acb0cf..5bd1f81f8b 100644
--- a/src/dhcp-manager/systemd-dhcp/nm-sd-adapt.h
+++ b/src/dhcp-manager/systemd-dhcp/nm-sd-adapt.h
@@ -54,8 +54,11 @@ _slog_level_to_nm (int slevel)
#define log_meta(level, file, line, func, format, ...) \
G_STMT_START { \
guint32 _l = _slog_level_to_nm ((level)); \
- if (nm_logging_enabled (_l, LOGD_DHCP)) \
- _nm_log (#file ":" #line, func, _l, LOGD_DHCP, format, ## __VA_ARGS__); \
+ if (nm_logging_enabled (_l, LOGD_DHCP)) { \
+ const char *_location = strrchr ((file ":" G_STRINGIFY(line)), '/'); \
+ \
+ _nm_log (_location ? _location + 1 : (file ":" G_STRINGIFY(line)), func, _l, LOGD_DHCP, format, ## __VA_ARGS__); \
+ } \
} G_STMT_END
#define log_debug(...) log_full(LOG_DEBUG, __VA_ARGS__)