[PATCH] dmesg: restrict output to default log level by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When loglevel is set to debug, dmesg shows a torrent of messages,
because by default it shows all messages logged regardless of the
default log level.

To make it more convenient to use, change this to only print the same
messages that are synchronously printed by default.

Users wanting to see more can specify a log level via an extra argument
to the dmesg command.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 commands/dmesg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/dmesg.c b/commands/dmesg.c
index 8a60f075076e..99675b6c2804 100644
--- a/commands/dmesg.c
+++ b/commands/dmesg.c
@@ -78,7 +78,7 @@ static int do_dmesg(int argc, char *argv[])
 {
 	int opt, ret, i;
 	int delete_buf = 0, emit = 0;
-	unsigned flags = 0, levels = 0;
+	unsigned flags = 0, levels = GENMASK(CONFIG_DEFAULT_LOGLEVEL, 0);
 	char *set = NULL;
 
 	while ((opt = getopt(argc, argv, "ctderl:n:")) > 0) {
-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux