about summary refs log tree commit diff
path: root/src/libmain/shared.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-19T23·39+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-19T23·39+0200
commitdb55940d9e9fd502b17522d011dfd941e3f69c5d (patch)
tree3f00e36e8c2afe2ac797218d5ac7274f1dae142f /src/libmain/shared.cc
parentb3491c781cb4be55f981b7456fcdbe5c4f869f01 (diff)
Support systemd log severity prefixes
This is mostly useful for hydra-queue-runner.
Diffstat (limited to 'src/libmain/shared.cc')
-rw-r--r--src/libmain/shared.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index f300fbf1b463..575fa339a86c 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -90,6 +90,7 @@ static void setLogType(string lt)
     if (lt == "pretty") logType = ltPretty;
     else if (lt == "escapes") logType = ltEscapes;
     else if (lt == "flat") logType = ltFlat;
+    else if (lt == "systemd") logType = ltSystemd;
     else throw UsageError("unknown log type");
 }
 
@@ -116,6 +117,9 @@ void initNix()
 
     std::ios::sync_with_stdio(false);
 
+    if (getEnv("IN_SYSTEMD") == "1")
+        logType = ltSystemd;
+
     settings.processEnvironment();
     settings.loadConfFile();