@@ -31,6 +31,7 @@ module Katip.Monadic
3131 , runKatipContextT
3232 , katipAddNamespace
3333 , katipAddContext
34+ , katipNoLogging
3435 , KatipContextTState(..)
3536 ) where
3637
@@ -311,6 +312,8 @@ runKatipContextT le ctx ns = flip runReaderT lts . unKatipContextT
311312
312313
313314-------------------------------------------------------------------------------
315+-- | Append a namespace segment to the current namespace for the given
316+-- monadic action, then restore the previous state afterwards.
314317katipAddNamespace
315318 :: (Monad m)
316319 => Namespace
@@ -321,6 +324,8 @@ katipAddNamespace ns (KatipContextT f) =
321324
322325
323326-------------------------------------------------------------------------------
327+-- | Append some context to the current context for the given monadic
328+-- action, then restore the previous state afterwards.
324329katipAddContext
325330 :: ( LogItem i
326331 , Monad m
@@ -330,3 +335,15 @@ katipAddContext
330335 -> KatipContextT m a
331336katipAddContext i (KatipContextT f) =
332337 KatipContextT (local (\r -> r { ltsContext = (ltsContext r) <> liftPayload i}) f)
338+
339+
340+-------------------------------------------------------------------------------
341+-- | Disable all scribes for the given monadic action, then restore
342+-- them afterwards.
343+katipNoLogging
344+ :: ( Monad m
345+ )
346+ => KatipContextT m a
347+ -> KatipContextT m a
348+katipNoLogging (KatipContextT f) =
349+ KatipContextT (local (\r -> r { ltsLogEnv = clearScribes (ltsLogEnv r)}) f)