diff options
-rw-r--r-- | Biz/Log.hs | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -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 |