mirror of
https://github.com/troglobit/finit.git
synced 2026-10-31 13:00:32 +00:00
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:
1 parent
f9732a6fb9
commit
a94c97221e
1 file changed
+4
-1
@@ -197,12 +197,15 @@ void logit(int prio, const char *fmt, ...)
|
|||||||
|
|
||||||
fp = fopen("/dev/kmsg", "w");
|
fp = fopen("/dev/kmsg", "w");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
|
if (debug)
|
||||||
|
prio = LOG_ERR;
|
||||||
|
|
||||||
fprintf(fp, "<%d>finit[1]:", LOG_DAEMON | prio);
|
fprintf(fp, "<%d>finit[1]:", LOG_DAEMON | prio);
|
||||||
vfprintf(fp, fmt, ap);
|
vfprintf(fp, fmt, ap);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Failed opening /dev/kmsg for appending ...\n");
|
fprintf(stderr, "Failed opening /dev/kmsg for appending ...\n");
|
||||||
if (prio <= LOG_ERR)
|
if (debug || prio <= LOG_ERR)
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|||||||
Reference in new issue
Block a user