on master help sign in
Add clearScribes
f66bfecMichael Xavier
katip/src/Katip.hs+1
@@ -39,6 +39,7 @@ module Katip
39 , initLogEnv
39 , initLogEnv
40 , registerScribe
40 , registerScribe
41 , unregisterScribe
41 , unregisterScribe
42+ , clearScribes
42
43
43 -- * Logging Functions
44 -- * Logging Functions
44 , LogStr (..)
45 , LogStr (..)
katip/src/Katip/Core.hs+12
@@ -454,6 +454,8 @@ initLogEnv an env = LogEnv
454
454
455
455
456-------------------------------------------------------------------------------
456-------------------------------------------------------------------------------
457+-- | Add a scribe to the list. All future log calls will go to this
458+-- scribe in addition to the others.
457registerScribe
459registerScribe
458 :: Text
460 :: Text
459 -- ^ Name the scribe
461 -- ^ Name the scribe
@@ -464,6 +466,8 @@ registerScribe nm h = logEnvScribes . at nm .~ Just h
464
466
465
467
466-------------------------------------------------------------------------------
468-------------------------------------------------------------------------------
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.
467unregisterScribe
471unregisterScribe
468 :: Text
472 :: Text
469 -- ^ Name of the scribe
473 -- ^ Name of the scribe
@@ -472,6 +476,14 @@ unregisterScribe
472unregisterScribe nm = logEnvScribes . at nm .~ Nothing
476unregisterScribe nm = logEnvScribes . at nm .~ Nothing
473
477
474
478
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+
475
487
476-------------------------------------------------------------------------------
488-------------------------------------------------------------------------------
477-- | Monads where katip logging actions can be performed
489-- | Monads where katip logging actions can be performed