systemd: fix systemd logging statements to show "file:line (func)" properly

Previously, we would stringify the arguments, resulting in logging
lines like
    "__FILE__:__LINE__(__PRETTY_FUNCTION__): assert return: ..."
This commit is contained in:
Thomas Haller 2015-09-16 17:47:09 +02:00
parent 80d4fbf4ac
commit 1bc3e1d513

View file

@ -75,18 +75,20 @@ G_STMT_START { \
#define log_assert_failed(e, file, line, func) \
G_STMT_START { \
nm_log_err (LOGD_DHCP, #file ":" #line "(" #func "): assertion failed: " # e); \
nm_log_err (LOGD_DHCP, "%s:%d (%s): assertion failed: %s", (""file), (line), (func), G_STRINGIFY (e)); \
g_assert (FALSE); \
} G_STMT_END
#define log_assert_failed_unreachable(t, file, line, func) \
G_STMT_START { \
nm_log_err (LOGD_DHCP, #file ":" #line "(" #func "): assert unreachable: " # t); \
nm_log_err (LOGD_DHCP, "%s:%d (%s): assert unreachable: %s", (""file), (line), (func), G_STRINGIFY (t)); \
g_assert_not_reached (); \
} G_STMT_END
#define log_assert_failed_return(e, file, line, func) \
nm_log_err (LOGD_DHCP, #file ":" #line "(" #func "): assert return: " # e); \
G_STMT_START { \
nm_log_err (LOGD_DHCP, "%s:%d (%s): assert return: %s", (""file), (line), (func), G_STRINGIFY (e)); \
} G_STMT_END
#define log_oom nm_log_err(LOGD_CORE, "%s:%s/%s: OOM", __FILE__, __LINE__, __func__)