summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
Diffstat (limited to 'Biz')
-rw-r--r--Biz/Log.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Biz/Log.hs b/Biz/Log.hs
index c206dc9..c3362d9 100644
--- a/Biz/Log.hs
+++ b/Biz/Log.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-}
@@ -47,11 +48,14 @@ area =
msg :: Lvl -> [Text] -> IO ()
msg lvl labels =
case area of
- -- systemd doesn't render msgs produced by putChunk, so when live we don't
- -- use rainbow at all
- "Live" -> putStr txt
- _ -> Rainbow.hPutChunks IO.stderr [fore color <| clear <> chunk txt <> "\r"]
+ "Live" -> putDumb
+ _ ->
+ Env.getEnv "TERM" +> \case
+ "dumb" -> putDumb
+ _ -> Rainbow.hPutChunks IO.stderr [fore color <| clear <> chunk txt <> "\r"]
where
+ -- For systemd-journal, emacs *compilation* buffers, etc.
+ putDumb = putStr <| txt <> "\n"
txt = Text.intercalate gap (label : labels)
(color, label) = case lvl of
Good -> (green, "good")