diff options
author | Oleksij Rempel <o.rempel@pengutronix.de> | 2019-02-21 14:26:03 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-02-27 09:20:28 +0100 |
commit | 34b9ee02ae460f4283f6096db308d5e7f8f36d45 (patch) | |
tree | 19f6b9a0343c88d3b4e12dff7f2066042b7bb67d /common/console_common.c | |
parent | 3f3cf502063c8bc7733147260cf71f43540176c0 (diff) | |
download | barebox-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/console_common.c')
-rw-r--r-- | common/console_common.c | 5 |
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); |