From d35305fe83686da819466b573fcdbb8bdaf80813 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 2 Jul 2019 09:22:48 +0200 Subject: [PATCH] basic/log: put location in a dark shade of yellow It is different then the other colors we use. Tested on gnome-terminal, urxvt, urxvt -rv, xterm, linux console. --- src/basic/log.c | 8 +++++++- src/basic/terminal-util.h | 13 +++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/basic/log.c b/src/basic/log.c index 84986a0970..6648633f97 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -351,7 +351,13 @@ static int write_to_console( get_log_colors(LOG_PRI(level), &on, &off, NULL); if (show_location) { - (void) snprintf(location, sizeof location, "%s:%i: ", file, line); + const char *lon = "", *loff = ""; + if (show_color) { + lon = ANSI_HIGHLIGHT_YELLOW4; + loff = ANSI_NORMAL; + } + + (void) snprintf(location, sizeof location, "%s%s:%i%s: ", lon, file, line, loff); iovec[n++] = IOVEC_MAKE_STRING(location); } diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index 6e5b273c75..3e39768ab1 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -19,12 +19,13 @@ #define ANSI_GREY "\x1B[0;38;5;245m" /* Bold/highlighted */ -#define ANSI_HIGHLIGHT_RED "\x1B[0;1;31m" -#define ANSI_HIGHLIGHT_GREEN "\x1B[0;1;32m" -#define ANSI_HIGHLIGHT_YELLOW "\x1B[0;1;38;5;185m" -#define ANSI_HIGHLIGHT_BLUE "\x1B[0;1;34m" -#define ANSI_HIGHLIGHT_MAGENTA "\x1B[0;1;35m" -#define ANSI_HIGHLIGHT_GREY "\x1B[0;1;38;5;245m" +#define ANSI_HIGHLIGHT_RED "\x1B[0;1;31m" +#define ANSI_HIGHLIGHT_GREEN "\x1B[0;1;32m" +#define ANSI_HIGHLIGHT_YELLOW "\x1B[0;1;38;5;185m" +#define ANSI_HIGHLIGHT_BLUE "\x1B[0;1;34m" +#define ANSI_HIGHLIGHT_MAGENTA "\x1B[0;1;35m" +#define ANSI_HIGHLIGHT_GREY "\x1B[0;1;38;5;245m" +#define ANSI_HIGHLIGHT_YELLOW4 "\x1B[0;1;38;5;100m" /* Underlined */ #define ANSI_HIGHLIGHT_RED_UNDERLINE "\x1B[0;1;4;31m" -- 2.25.1