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 <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-09-04 17:15:41 +02:00
parent 74eb2bf4d2
commit 88d8ab67c9
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -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)
+2 -2
View File
@@ -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;
}
}