@@ -28,15 +28,14 @@ import Katip
2828-- lens_example for a slightly cleaner and more general pattern.
2929main :: IO ()
3030main = do
31− le <- initLogEnv "MyApp" "production"
3231 -- We'll set up a scribe that logs to stdout and will only log item
3332 -- fields permitted for Verbosity 2 and will throw out Debug
3433 -- messages entirely. Note that katip provides facilities like
3534 -- 'unregisterScribe' and 'registerScribe' to make it possible to
3635 -- hot-swap scribes at runtime if you need to.
37− (handleScribe, finaliser) <- mkHandleScribe ColorIfTerminal stdout InfoS V2
38− let le' = registerScribe "stdout" handleScribe le
39− let s = MyState M.mempty mempty le'
36+ handleScribe <- mkHandleScribe ColorIfTerminal stdout InfoS V2
37+ le <- registerScribe "stdout" handleScribe defaultScribeSettings =<< initLogEnv "MyApp" "production"
38+ let s = MyState M.mempty mempty le
4039 runStack s $ do
4140 $(logTM) InfoS "Started"
4241 -- this will add "confrabulation" to the current namespace, making
@@ -52,7 +51,9 @@ main = do
5251 $(logTM) InfoS "Namespace and context are back to normal"
5352 noLogging $
5453 $(logTM) DebugS "You'll never see this log message!"
55− finaliser
54+ -- This blocking call flushes all in-flight messages through
55+ -- handlers and then finalizes each scribe.
56+ void (closeScribes le)
5657
5758-------------------------------------------------------------------------------
5859newtype ConfrabLogCTX = ConfrabLogCTX Int