@@ -13,7 +13,6 @@ import Data.Text (Text)
13import Data.Text.Lazy.Builder
13import Data.Text.Lazy.Builder
14import Data.Text.Lazy.IO as T
14import Data.Text.Lazy.IO as T
15import System.IO
15import System.IO
16−import System.IO.Unsafe (unsafePerformIO)
17import qualified Control.Concurrent.Chan.Unagi.Bounded as U
16import qualified Control.Concurrent.Chan.Unagi.Bounded as U
18import Control.Concurrent.Async
17import Control.Concurrent.Async
19-------------------------------------------------------------------------------
18-------------------------------------------------------------------------------
@@ -122,17 +121,12 @@ formatItem withColor verb Item{..} =
124-------------------------------------------------------------------------------
123-------------------------------------------------------------------------------
125−-- | An implicit environment to enable logging directly ouf of the IO monad.
124+-- | Provides a simple log environment with 1 scribe going to
126−-- Be careful as this LogEnv won't perform any resource cleanup for you.
125+-- stdout. This is a decent example of how to build a LogEnv and is
127−_ioLogEnv :: LogEnv
126+-- best for scripts that just need a quick, reasonable set up to log
128−_ioLogEnv = unsafePerformIO $ do
127+-- to stdout.
128+ioLogEnv :: Severity -> Verbosity -> IO LogEnv
129+ioLogEnv sev verb = do
129− le <- initLogEnv "io" "io"
130+ le <- initLogEnv "io" "io"
130− (lh, _) <- mkHandleScribe ColorIfTerminal stdout DebugS V3
131+ (lh, _) <- mkHandleScribe ColorIfTerminal stdout sev verb
131− return $ registerScribe "stdout" lh le
132+ return $ registerScribe "stdout" lh le
132−{-# NOINLINE _ioLogEnv #-}
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