about summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index f54fd5fb623f..7959b76f868d 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -477,12 +477,24 @@ void printMsg_(Verbosity level, const FormatOrString & fs)
 {
     checkInterrupt();
     if (level > verbosity) return;
+
     string prefix;
     if (logType == ltPretty)
         for (int i = 0; i < nestingLevel; i++)
             prefix += "|   ";
     else if (logType == ltEscapes && level != lvlInfo)
         prefix = "\033[" + escVerbosity(level) + "s";
+    else if (logType == ltSystemd) {
+        char c;
+        switch (level) {
+            case lvlError: c = '3'; break;
+            case lvlInfo: c = '5'; break;
+            case lvlTalkative: case lvlChatty: c = '6'; break;
+            default: c = '7';
+        }
+        prefix = string("<") + c + ">";
+    }
+
     string s = (format("%1%%2%\n") % prefix % fs.s).str();
     if (!isatty(STDERR_FILENO)) s = filterANSIEscapes(s);
     writeToStderr(s);