From 745f75457ccabfc8b80c324e88723901d35c0d29 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Mon, 13 Oct 2008 20:15:56 +0000 Subject: [PATCH] Add log levels to the output. In order to use this enable EXPERT and CONSOLE_LOG_LEVEL. EXPERT seemed like the best fit. Signed-off-by: Myles Watson Acked-by: Peter Stuge Acked-by: Uwe Hermann git-svn-id: svn://coreboot.org/repository/coreboot-v3@921 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- lib/Kconfig | 5 +++++ lib/console.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/Kconfig b/lib/Kconfig index 897c8445b9..43089687c7 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -68,6 +68,11 @@ config CONSOLE help Support for various types of (debugging) consoles. +config CONSOLE_PREPEND_LOG_LEVEL + boolean "Prepend log level to messages" + default n + depends CONSOLE && EXPERT + choice prompt "Console log level" default CONSOLE_LOGLEVEL_8 diff --git a/lib/console.c b/lib/console.c index 3e9bd0e63c..08c192a1a7 100644 --- a/lib/console.c +++ b/lib/console.c @@ -132,12 +132,22 @@ int printk(int msg_level, const char *fmt, ...) va_list args; int i; +#ifdef CONFIG_CONSOLE_PREPEND_LOG_LEVEL + console_tx_byte('<', (void *)0); + console_tx_byte(msg_level + '0', (void *)0); + console_tx_byte('>', (void *)0); + + i = 3; + if (msg_level > console_loglevel()) { return 0; } +#else + i = 0; +#endif va_start(args, fmt); - i = vtxprintf(console_tx_byte, (void *)0, fmt, args); + i += vtxprintf(console_tx_byte, (void *)0, fmt, args); va_end(args); return i;