summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
Diffstat (limited to 'Biz')
-rw-r--r--Biz/Log.hs19
1 files changed, 14 insertions, 5 deletions
diff --git a/Biz/Log.hs b/Biz/Log.hs
index 86db272..a1afd1d 100644
--- a/Biz/Log.hs
+++ b/Biz/Log.hs
@@ -2,6 +2,15 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-}
+-- | Log reporting interface
+--
+-- Some guidelines:
+--
+-- * don't allow `mark` in final code
+--
+-- * don't use `br` after `info`, unless verbose mode is requested (--loud flag in bild)
+--
+-- * labels should be roughly hierarchical from general->specific
module Biz.Log
( Lvl (..),
good,
@@ -39,17 +48,17 @@ import System.IO.Unsafe (unsafePerformIO)
data Lvl = Good | Pass | Info | Warn | Fail | Mark
--- | Get the environment. This should probably return 'Biz.Dragons.Area'
--- instead of 'String'.
-area :: String
+-- | Get the environment. This should probably return 'Biz.App.Area' instead of
+-- 'String', but I don't want to depend on everything in 'Biz.App', so some kind
+-- of refactor is needed.
+area :: IO String
area =
Env.lookupEnv "AREA"
/> maybe "Test" identity
- |> unsafePerformIO
msg :: Lvl -> [Text] -> IO ()
msg lvl labels =
- case area of
+ area +> \case
"Live" -> putDumb
_ ->
Env.getEnv "TERM" +> \case