on master help sign in
Add clearScribes
commitf66bfec21c1a156119f578760539be8e59a784bd authorMichael Xavier <michael@michaelxavier.net> dateThu 4 Jun 2015, 10:57 (11 years ago) parent23c765d
2 files changed+13
katip/src/Katip.hs+1 katip/src/Katip/Core.hs+12
katip/src/Katip.hs+1
@@ -39,6 +39,7 @@ module Katip
3939 , initLogEnv
4040 , registerScribe
4141 , unregisterScribe
42+ , clearScribes
4243
4344 -- * Logging Functions
4445 , LogStr (..)
katip/src/Katip/Core.hs+12
@@ -454,6 +454,8 @@ initLogEnv an env = LogEnv
454454
455455
456456-------------------------------------------------------------------------------
457+-- | Add a scribe to the list. All future log calls will go to this
458+-- scribe in addition to the others.
457459registerScribe
458460 :: Text
459461 -- ^ Name the scribe
@@ -464,6 +466,8 @@ registerScribe nm h = logEnvScribes . at nm .~ Just h
464466
465467
466468-------------------------------------------------------------------------------
469+-- | Remove a scribe from the list. All future log calls will no
470+-- longer use this scribe. If the given scribe doesn't exist, its a no-op.
467471unregisterScribe
468472 :: Text
469473 -- ^ Name of the scribe
@@ -472,6 +476,14 @@ unregisterScribe
472476unregisterScribe nm = logEnvScribes . at nm .~ Nothing
473477
474478
479+-------------------------------------------------------------------------------
480+-- | Unregister *all* scribes. Logs will go off into space from this
481+-- point onward until new scribes are added.
482+clearScribes
483+ :: LogEnv
484+ -> LogEnv
485+clearScribes = logEnvScribes .~ mempty
486+
475487
476488-------------------------------------------------------------------------------
477489-- | Monads where katip logging actions can be performed