From: Karel Zak Date: Tue, 14 Oct 2014 08:20:19 +0000 (+0200) Subject: dmesg: improve reltime colors X-Git-Tag: v2.26-rc1~320 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33ecab2b9cb77dd34fed1e6cf6394b88ef880f35;p=thirdparty%2Futil-linux.git dmesg: improve reltime colors [ +0.004034] sd 113:0:0:0: [sdb] Attached SCSI disk [Oct10 13:04] sdb: unknown partition table [ +0.034011] sdb: sdb1 sdb2 sdb3 sdb4 < sdb5 sdb6 > .. the "Oct10 13:04" is possible to colorize by "timebreak" scheme (default is bold green). Signed-off-by: Karel Zak --- diff --git a/sys-utils/dmesg.1 b/sys-utils/dmesg.1 index 8a267f8677..bf525e4e98 100644 --- a/sys-utils/dmesg.1 +++ b/sys-utils/dmesg.1 @@ -204,6 +204,10 @@ The message sub-system prefix (e.g. "ACPI:"). .B time The message timestamp. .TP +.B timebreak +The message timestamp in short ctime format in \fB\-\-reltime\fR +or \fB\-\-human\fR output. +.TP .B alert The text of the message with the alert log priority. .TP diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c index 661aaa9d98..1a1ace4ab4 100644 --- a/sys-utils/dmesg.c +++ b/sys-utils/dmesg.c @@ -71,6 +71,7 @@ struct dmesg_color { enum { DMESG_COLOR_SUBSYS, DMESG_COLOR_TIME, + DMESG_COLOR_TIMEBREAK, DMESG_COLOR_ALERT, DMESG_COLOR_CRIT, DMESG_COLOR_ERR, @@ -82,6 +83,7 @@ static const struct dmesg_color colors[] = { [DMESG_COLOR_SUBSYS] = { "subsys", UL_COLOR_BROWN }, [DMESG_COLOR_TIME] = { "time", UL_COLOR_GREEN }, + [DMESG_COLOR_TIMEBREAK] = { "timebreak",UL_COLOR_GREEN UL_COLOR_BOLD }, [DMESG_COLOR_ALERT] = { "alert", UL_COLOR_REVERSE UL_COLOR_RED }, [DMESG_COLOR_CRIT] = { "crit", UL_COLOR_BOLD UL_COLOR_RED }, [DMESG_COLOR_ERR] = { "err", UL_COLOR_RED }, @@ -921,6 +923,7 @@ static void print_record(struct dmesg_control *ctl, if (cur.tm_min != ctl->lasttm.tm_min || cur.tm_hour != ctl->lasttm.tm_hour || cur.tm_yday != ctl->lasttm.tm_yday) { + dmesg_enable_color(DMESG_COLOR_TIMEBREAK); printf("[%s] ", short_ctime(&cur, buf, sizeof(buf))); } else { if (delta < 10)