LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Folkert van Heusden <folkert@vanheusden.com>
To: linux-kernel@vger.kernel.org
Subject: emit loglevel for printk output
Date: Thu, 30 Oct 2008 21:54:10 +0100	[thread overview]
Message-ID: <20081030205410.GH11214@vanheusden.com> (raw)

Hi,

I propose a character before each logged line so that one can easily grep
through dmesg output for errors/warnings/etc.
It's just a suggestion, maybe there are better ways. E.g. iirc openbsd
uses colors.
errors/criticals/fatals: -
warnings: !
debugging: #
info: +

Signed-off: folkert van heusden <folkert@vanheusden.com>

--- linux-source-2.6.27/kernel/printk.c.org	2008-10-30 17:07:02.000000000 +0100
+++ linux-source-2.6.27/kernel/printk.c	2008-10-30 21:07:17.000000000 +0100
@@ -730,6 +730,16 @@
 			printed_len += 3;
 			new_text_line = 0;
 
+			if (current_log_level <= (KERN_ERR[1] - '0'))
+				emit_log_char('-');
+			else if (current_log_level == (KERN_WARNING[1] - '0'))
+				emit_log_char('!');
+			else if (current_log_level == (KERN_DEBUG[1] - '0'))
+				emit_log_char('#');
+			else
+				emit_log_char('+');
+			emit_log_char(' ');
+
 			if (printk_time) {
 				/* Follow the token with the time */
 				char tbuf[50], *tp;


Folkert van Heusden

-- 
Ever wonder what is out there? Any alien races? Then please support
the seti@home project: setiathome.ssl.berkeley.edu
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com

                 reply	other threads:[~2008-10-30 20:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081030205410.GH11214@vanheusden.com \
    --to=folkert@vanheusden.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: emit loglevel for printk output' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).