summaryrefslogtreecommitdiff
path: root/kern/log.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-10 17:23:24 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-10 17:23:24 +0200
commit562904ff8e2f5e40e4be76dc7c4d919a4bda05f8 (patch)
tree4c077ffcda80d2c7eed1758d81ad00dba1d347f4 /kern/log.c
parentec7c306bda9a7a4a8b656417e505041e97779a5c (diff)
kern/log: filter output based on log level
Diffstat (limited to 'kern/log.c')
-rw-r--r--kern/log.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kern/log.c b/kern/log.c
index 1320d3b8..90ae4331 100644
--- a/kern/log.c
+++ b/kern/log.c
@@ -48,6 +48,8 @@ static char log_buffer[LOG_BUFFER_SIZE];
static unsigned long log_nr_overruns;
+static unsigned int log_print_level;
+
/*
* Global lock.
*
@@ -187,7 +189,15 @@ log_record_init_consume(struct log_record *record)
static void
log_record_print(const struct log_record *record)
{
- printf("%7s %s\n", log_level2str(record->level), record->buffer);
+ if (record->level > log_print_level) {
+ return;
+ }
+
+ if (record->level <= LOG_WARNING) {
+ printf("%7s %s\n", log_level2str(record->level), record->buffer);
+ } else {
+ printf("%s\n", record->buffer);
+ }
}
static void
@@ -250,6 +260,7 @@ log_setup(void)
{
cbuf_init(&log_cbuf, log_buffer, sizeof(log_buffer));
spinlock_init(&log_lock);
+ log_print_level = LOG_INFO;
}
void __init