log.c: Filter debug messages by default, like before refactor
Ways to log:
Set debug, using kernel cmdline, or edit the sources
Change loglevel severity, default blocks > LOG_NOTICE
@@ -104,16 +104,15 @@ static void early_logit(int prio, const char *fmt, va_list ap)
{
FILE *fp;
+ if (!debug && prio > loglevel)
+ return;
+
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 {
- if (debug || prio <= LOG_ERR)
vfprintf(stderr, fmt, ap);
}
}
