summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorOleksij Rempel <o.rempel@pengutronix.de>2019-02-21 14:26:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-02-27 09:20:28 +0100
commit34b9ee02ae460f4283f6096db308d5e7f8f36d45 (patch)
tree19f6b9a0343c88d3b4e12dff7f2066042b7bb67d /common
parent3f3cf502063c8bc7733147260cf71f43540176c0 (diff)
downloadbarebox-34b9ee02ae460f4283f6096db308d5e7f8f36d45.tar.gz
barebox-34b9ee02ae460f4283f6096db308d5e7f8f36d45.tar.xz
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 <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/console_common.c5
1 files changed, 4 insertions, 1 deletions
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);