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>
This commit is contained in:
Thomas Haller 2014-11-11 22:26:00 +01:00
parent 142dbf213e
commit 900763ce0f

View file

@ -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__)