@@ -1,7 +1,32 @@
1−-- | Includes all of the API's youll need to use Katip. Be sure to
1+-- | Includes all of the APIs youll need to use Katip. Be sure to
22-- check out the included @examples@ directory for an example of
33-- usage.
44--
5+-- Here's a basic example:
6+--
7+-- @
8+--
9+-- import Control.Exception
10+-- import Katip
11+--
12+-- main :: IO ()
13+-- main = do
14+-- handleScribe <- mkHandleScribe ColorIfTerminal stdout InfoS V2
15+-- let makeLogEnv = registerScribe "stdout" handleScribe defaultScribeSettings =<< initLogEnv "MyApp" "production"
16+-- -- closeScribes will stop accepting new logs, flush existing ones and clean up resources
17+-- bracket makeLogEnv closeScribes $ \le -> do
18+-- let initialContext = () -- this context will be attached to every log in your app and merged w/ subsequent contexts
19+-- let initialNamespace = "main"
20+-- runKatipContextT le initialContext initialNamespace $ do
21+-- $(logTM) InfoS "Hello Katip"
22+-- -- This adds a namespace to the current namespace and merges a piece of contextual data into your context
23+-- katipAddNamespace "additional_namespace" $ katipAddContext (sl "some_context" True) $ do
24+-- $(logTM) WarningS "Now we're getting fancy"
25+-- katipNoLogging $ do
26+-- $(logTM) DebugS "You will never see this!"
27+--
28+-- @
29+--
530-- To get up and running, the workflow is generally:
631--
732-- * Set up a 'LogEnv' using 'initLogEnv'.
@@ -40,7 +65,7 @@ module Katip
4065 , Scribe (..)
4166 , LogEnv (..)
4267 , SimpleLogPayload, sl
43− , defaultScribeSettings --TODO: lenses and whatnot to avoid breakage
68+ , defaultScribeSettings
4469 , ScribeSettings
4570 , scribeBufferSize
4671 , _scribeBufferSize
@@ -64,7 +89,7 @@ module Katip
6489 , logEnvTimer
6590 , logEnvScribes
6691
67− -- * A Built-in Monad For Logging
92+ -- * A Built-in Monad For Simple Logging
6893 , KatipT (..)
6994 , runKatipT
7095
@@ -90,7 +115,7 @@ module Katip
90115 , logT
91116 , logItem
92117 , logException
93− -- ** 'KatipContext' Logging Functions
118+ -- ** 'KatipContext': Logging With Context
94119 -- $katipcontextlogging
95120 , KatipContext (..)
96121 , logFM
@@ -99,6 +124,10 @@ module Katip
99124 , logExceptionM
100125 , AnyLogContext
101126 , LogContexts, liftPayload
127+ -- *** Temporarily Changing Logging Behavior
128+ , katipAddNamespace
129+ , katipAddContext
130+ , katipNoLogging
102131
103132 -- * Included Scribes
104133 , mkHandleScribe
@@ -112,9 +141,6 @@ module Katip
112141 -- * KatipContextT - Utility transformer that provides Katip and KatipContext instances
113142 , KatipContextT
114143 , runKatipContextT
115− , katipAddNamespace
116− , katipAddContext
117− , katipNoLogging
118144 ) where
119145
120146-------------------------------------------------------------------------------