summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/dmesg.c8
-rw-r--r--common/console_common.c3
-rw-r--r--include/printk.h1
3 files changed, 10 insertions, 2 deletions
diff --git a/commands/dmesg.c b/commands/dmesg.c
index 510bc16..5c27285 100644
--- a/commands/dmesg.c
+++ b/commands/dmesg.c
@@ -30,7 +30,7 @@ static int do_dmesg(int argc, char *argv[])
int delete_buf = 0, emit = 0;
unsigned flags = 0;
- while ((opt = getopt(argc, argv, "ctde")) > 0) {
+ while ((opt = getopt(argc, argv, "ctder")) > 0) {
switch (opt) {
case 'c':
delete_buf = 1;
@@ -44,6 +44,9 @@ static int do_dmesg(int argc, char *argv[])
case 'e':
emit = 1;
break;
+ case 'r':
+ flags |= BAREBOX_LOG_PRINT_RAW | BAREBOX_LOG_PRINT_TIME;
+ break;
default:
return COMMAND_ERROR_USAGE;
}
@@ -88,13 +91,14 @@ BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT ("-c", "Delete messages after printing them")
BAREBOX_CMD_HELP_OPT ("-d", "Show a time delta to the last message")
BAREBOX_CMD_HELP_OPT ("-e <msg>", "Emit a log message")
+BAREBOX_CMD_HELP_OPT ("-r", "Print timestamp and log-level prefixes.")
BAREBOX_CMD_HELP_OPT ("-t", "Show timestamp informations")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(dmesg)
.cmd = do_dmesg,
BAREBOX_CMD_DESC("Print or control log messages")
- BAREBOX_CMD_OPTS("[-cdet]")
+ BAREBOX_CMD_OPTS("[-cdert]")
BAREBOX_CMD_GROUP(CMD_GRP_INFO)
BAREBOX_CMD_HELP(cmd_dmesg_help)
BAREBOX_CMD_END
diff --git a/common/console_common.c b/common/console_common.c
index 0131a11..bc3a305 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -202,6 +202,9 @@ void log_print(unsigned flags)
uint64_t diff = log->timestamp - time_beginning;
unsigned long difful;
+ if (flags & (BAREBOX_LOG_PRINT_RAW))
+ printf("<%i>", log->level);
+
do_div(diff, 1000);
difful = diff;
diff --git a/include/printk.h b/include/printk.h
index ab2c64c..64205b2 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -136,6 +136,7 @@ extern void log_clean(unsigned int limit);
#define BAREBOX_LOG_PRINT_TIME (1 << 0)
#define BAREBOX_LOG_DIFF_TIME (1 << 1)
+#define BAREBOX_LOG_PRINT_RAW (1 << 2)
void log_print(unsigned flags);