From 34b9ee02ae460f4283f6096db308d5e7f8f36d45 Mon Sep 17 00:00:00 2001 From: Oleksij Rempel Date: Thu, 21 Feb 2019 14:26:03 +0100 Subject: commands: dmesg: add -l option to restrict output level Same as linux dmesg, barebox dmesg will be able to restrict output level by using -l option. For example "dmesg -l err,warn" This functionality can be used for test automation. Signed-off-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- common/console_common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/console_common.c b/common/console_common.c index bc3a305b27..4aa54de97a 100644 --- a/common/console_common.c +++ b/common/console_common.c @@ -193,7 +193,7 @@ static int console_common_init(void) } device_initcall(console_common_init); -void log_print(unsigned flags) +void log_print(unsigned flags, unsigned levels) { struct log_entry *log; unsigned long last = 0; @@ -202,6 +202,9 @@ void log_print(unsigned flags) uint64_t diff = log->timestamp - time_beginning; unsigned long difful; + if (levels && !(levels & (1 << log->level))) + continue; + if (flags & (BAREBOX_LOG_PRINT_RAW)) printf("<%i>", log->level); -- cgit v1.2.3