Blob Blame History Raw
From 67b548434f258224239e41672478a0038d5c9d30 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 5 Dec 2018 18:42:32 +0100
Subject: [PATCH] logs-show: use grey color for de-emphasizing journal log
 output

(cherry picked from commit 67df9b7a06d749fdd84f19f7d75ccf0d743f6d72)

Resolves: #1695601
---
 src/basic/terminal-util.h | 2 ++
 src/shared/logs-show.c    | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h
index c0bd0e67a6..0055b72343 100644
--- a/src/basic/terminal-util.h
+++ b/src/basic/terminal-util.h
@@ -18,6 +18,7 @@
 #define ANSI_MAGENTA "\x1B[0;35m"
 #define ANSI_CYAN    "\x1B[0;36m"
 #define ANSI_WHITE   "\x1B[0;37m"
+#define ANSI_GREY    "\x1B[0;2;37m"
 
 /* Bold/highlighted */
 #define ANSI_HIGHLIGHT_BLACK   "\x1B[0;1;30m"
@@ -129,6 +130,7 @@ DEFINE_ANSI_FUNC(highlight_yellow,           HIGHLIGHT_YELLOW);
 DEFINE_ANSI_FUNC(highlight_blue,             HIGHLIGHT_BLUE);
 DEFINE_ANSI_FUNC(highlight_magenta,          HIGHLIGHT_MAGENTA);
 DEFINE_ANSI_FUNC(normal,                     NORMAL);
+DEFINE_ANSI_FUNC(grey,                       GREY);
 
 DEFINE_ANSI_FUNC_UNDERLINE(underline,                  UNDERLINE, NORMAL);
 DEFINE_ANSI_FUNC_UNDERLINE(highlight_underline,        HIGHLIGHT_UNDERLINE, HIGHLIGHT);
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 33afbe2f7f..c66e39d2fe 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -170,6 +170,10 @@ static bool print_multiline(
                         color_on = ANSI_HIGHLIGHT;
                         color_off = ANSI_NORMAL;
                         highlight_on = ANSI_HIGHLIGHT_RED;
+                } else if (priority >= LOG_DEBUG) {
+                        color_on = ANSI_GREY;
+                        color_off = ANSI_NORMAL;
+                        highlight_on = ANSI_HIGHLIGHT_RED;
                 }
         }