From c5bca5f80aa50506a18ccbb065b95173c5459319 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 9 Oct 2022 12:52:49 +0200 Subject: [PATCH] Add 'function():' prefix to new log macros, like the old ones Also, mark old log macros as DEPRECATED. Will be removed in a later release. Signed-off-by: Joachim Wiberg --- src/log.h | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/log.h b/src/log.h index c4f6ada4..c1e05627 100644 --- a/src/log.h +++ b/src/log.h @@ -54,20 +54,15 @@ static __attribute__ ((format (printf, 1, 2))) inline void dbg(char *fmt, ...) * General log macros, similar to those used by initctl. Initially intended * only for bridging client.c in Finit and initctl. */ -#define dbg(fmt, args...) logit(LOG_DEBUG, fmt, ##args) -#define warnx(fmt, args...) logit(LOG_WARNING, fmt, ##args) -#define warn(fmt, args...) logit(LOG_WARNING, fmt ": %s", ##args, strerror(errno)) -#define errx(rc, fmt, args...) logit(LOG_ERR, fmt, ##args) -#define err(rc, fmt, args...) logit(LOG_ERR, fmt ": %s", ##args, strerror(errno)) +#define dbg(fmt, args...) logit(LOG_DEBUG, "%s():" fmt, __func__, ##args) +#define warnx(fmt, args...) logit(LOG_WARNING, "%s():" fmt, __func__, ##args) +#define warn(fmt, args...) logit(LOG_WARNING, "%s():" fmt ": %s", __func__, ##args, strerror(errno)) +#define errx(rc, fmt, args...) logit(LOG_ERR, "%s():" fmt, __func__, ##args) +#define err(rc, fmt, args...) logit(LOG_ERR, "%s():" fmt ": %s", __func__, ##args, strerror(errno)) /* - * Developer error and debug messages, otherwise --> use logit() <-- - * ~~~~~~~~~~~ - * All of these prepend the function, so only use for critical warnings - * errors and debug messages. For all other user messages, see logit() - * - * The default log level is LOG_NOTICE. To toggle LOG_DEBUG messages, - * use `initctl debug` or add `debug` to the kernel cmdline. + * DEPRECATED developer error and debug messages, please migrate to above! + * Will be removed without further warning in a future Finit release. */ #define _d(fmt, args...) logit(LOG_DEBUG, "%s():" fmt, __func__, ##args) #define _w(fmt, args...) logit(LOG_WARNING, "%s():" fmt, __func__, ##args)