@@ -13,7 +13,6 @@ import Data.Text (Text)
1313import Data.Text.Lazy.Builder
1414import Data.Text.Lazy.IO as T
1515import System.IO
16−import System.IO.Unsafe (unsafePerformIO)
1716import qualified Control.Concurrent.Chan.Unagi.Bounded as U
1817import Control.Concurrent.Async
1918-------------------------------------------------------------------------------
@@ -122,17 +121,12 @@ formatItem withColor verb Item{..} =
122121
123122
124123-------------------------------------------------------------------------------
125−-- | An implicit environment to enable logging directly ouf of the IO monad.
126−-- Be careful as this LogEnv won't perform any resource cleanup for you.
127−_ioLogEnv :: LogEnv
128−_ioLogEnv = unsafePerformIO $ do
129− le <- initLogEnv "io" "io"
130− (lh, _) <- mkHandleScribe ColorIfTerminal stdout DebugS V3
131− return $ registerScribe "stdout" lh le
132−{-# NOINLINE _ioLogEnv #-}
133−
134−
135−-- -------------------------------------------------------------------------------
136−-- -- | A default IO instance to make prototype development easy. User
137−-- -- your own 'Monad' for production.
138−-- instance Katip IO where getLogEnv = return _ioLogEnv
124+-- | Provides a simple log environment with 1 scribe going to
125+-- stdout. This is a decent example of how to build a LogEnv and is
126+-- best for scripts that just need a quick, reasonable set up to log
127+-- to stdout.
128+ioLogEnv :: Severity -> Verbosity -> IO LogEnv
129+ioLogEnv sev verb = do
130+ le <- initLogEnv "io" "io"
131+ (lh, _) <- mkHandleScribe ColorIfTerminal stdout sev verb
132+ return $ registerScribe "stdout" lh le