From 3887aa4e8d2cf2703d8f1b5d26ac2c34544949b8 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 2 Aug 2023 17:43:56 -0400 Subject: Some notes on Biz.Log --- Biz/Log.hs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'Biz/Log.hs') 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 -- cgit v1.2.3