diff options
author | Ben Sima <ben@bsima.me> | 2023-08-02 17:43:56 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-08-02 17:43:56 -0400 |
commit | 3887aa4e8d2cf2703d8f1b5d26ac2c34544949b8 (patch) | |
tree | e2635899242b37e99d077e99294678a9deb02d4b /Biz | |
parent | 8ac03ae2c82b07381292ede57431ddddd0d4dbe4 (diff) |
Some notes on Biz.Log
Diffstat (limited to 'Biz')
-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 |