From 88d8ab67c903a27d2f7be9bc7e68e722603a2867 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 4 Sep 2016 17:15:41 +0200 Subject: [PATCH] Add _w() for developer warning logs Adjust debug levels slightly and add _w() macro for LOG_WARNING, useful when having /dev/kmsg as backend. The latter outputs any log <= LOG_ERR to console as well. Signed-off-by: Joachim Nilsson --- helpers.h | 3 ++- service.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/helpers.h b/helpers.h index 0b4a8e26..e3e3e8f4 100644 --- a/helpers.h +++ b/helpers.h @@ -38,8 +38,9 @@ * /dev/console as well. Useful for critical errors and early debug. */ #define _l(prio, fmt, args...) do { if (_slup) warnx(fmt, ##args); logit(prio, fmt "\n", ##args); } while (0) -#define _m(prio, fmt, args...) do { _l(prio, "finit:%s:%s() - " fmt, __FILE__, __func__, ##args); } while (0) +#define _m(prio, fmt, args...) do { _l(prio, "%s() - " fmt, __func__, ##args); } while (0) #define _d(fmt, args...) do { if (debug) { _m(LOG_DEBUG, fmt, ##args); } } while (0) +#define _w(fmt, args...) do { _m(LOG_WARNING, fmt, ##args); } while (0) #define _e(fmt, args...) do { _m(LOG_ERR, fmt, ##args); } while (0) #define _pe(fmt, args...) do { _m(LOG_ERR, fmt ". Error %d: %s", ##args, errno, strerror(errno)); } while (0) diff --git a/service.c b/service.c index 9e982da4..2ec50b19 100755 --- a/service.c +++ b/service.c @@ -268,7 +268,7 @@ static int service_start(svc_t *svc) if (strlen(arg) < (sizeof(buf) - strlen(buf))) strcat(buf, arg); } - _e("Starting %s: %s", svc->cmd, buf); + _d("Starting %s: %s", svc->cmd, buf); } svc->pid = pid; @@ -548,7 +548,7 @@ int service_register(int type, char *line, time_t mtime, char *username) plugin = plugin_find(ps); if (!plugin || !plugin->inetd.cmd) { - _e("Inetd service %s has no internal plugin, skipping.", service); + _w("Inetd service %s has no internal plugin, skipping.", service); return errno = ENOENT; } }