Force all log messages to console in --debug mode

As a last ditch effort to understand why an embedded system doesn't
boot, the operator should be able to see as much logs as possible
when enabling --debug mode on the kernel command line.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-09-18 10:27:03 +02:00
parent f9732a6fb9
commit a94c97221e
+4 -1
View File
@@ -197,12 +197,15 @@ void logit(int prio, const char *fmt, ...)
fp = fopen("/dev/kmsg", "w");
if (fp) {
if (debug)
prio = LOG_ERR;
fprintf(fp, "<%d>finit[1]:", LOG_DAEMON | prio);
vfprintf(fp, fmt, ap);
fclose(fp);
} else {
fprintf(stderr, "Failed opening /dev/kmsg for appending ...\n");
if (prio <= LOG_ERR)
if (debug || prio <= LOG_ERR)
vfprintf(stderr, fmt, ap);
}
va_end(ap);