@@ -31,6 +31,7 @@ module Katip.Monadic
31 , runKatipContextT
31 , runKatipContextT
32 , katipAddNamespace
32 , katipAddNamespace
33 , katipAddContext
33 , katipAddContext
34 , KatipContextTState(..)
35 , KatipContextTState(..)
@@ -311,6 +312,8 @@ runKatipContextT le ctx ns = flip runReaderT lts . unKatipContextT
313-------------------------------------------------------------------------------
314-------------------------------------------------------------------------------
315+-- | Append a namespace segment to the current namespace for the given
316+-- monadic action, then restore the previous state afterwards.
314katipAddNamespace
317katipAddNamespace
315 :: (Monad m)
318 :: (Monad m)
316 => Namespace
319 => Namespace
@@ -321,6 +324,8 @@ katipAddNamespace ns (KatipContextT f) =
323-------------------------------------------------------------------------------
326-------------------------------------------------------------------------------
327+-- | Append some context to the current context for the given monadic
328+-- action, then restore the previous state afterwards.
324katipAddContext
329katipAddContext
325 :: ( LogItem i
330 :: ( LogItem i
326 , Monad m
331 , Monad m
@@ -330,3 +335,15 @@ katipAddContext
330 -> KatipContextT m a
335 -> KatipContextT m a
331katipAddContext i (KatipContextT f) =
336katipAddContext i (KatipContextT f) =
332 KatipContextT (local (\r -> r { ltsContext = (ltsContext r) <> liftPayload i}) f)
337 KatipContextT (local (\r -> r { ltsContext = (ltsContext r) <> liftPayload i}) f)
340+-------------------------------------------------------------------------------
341+-- | Disable all scribes for the given monadic action, then restore
346+ => KatipContextT m a
347+ -> KatipContextT m a
348+katipNoLogging (KatipContextT f) =
349+ KatipContextT (local (\r -> r { ltsLogEnv = clearScribes (ltsLogEnv r)}) f)