on master help sign in
Merge branch 'master' of github.com:Soostone/katip
commit7313316bae7999ff76266ee680972964ce0349c4 authorMichael Xavier <michael@michaelxavier.net> dateThu 15 Mar 2018, 11:51 (9 years ago) parent5b8659110f69b9
2 files changed+10−2
katip/katip.cabal+2−2 katip/src/Katip/Monadic.hs+8
katip/katip.cabal+2−2
@@ -64,7 +64,7 @@ library
6464 , hostname >=1.0 && <1.1
6565 , old-locale >= 1.0 && < 1.1
6666 , string-conv >= 0.1 && < 0.2
67− , template-haskell >= 2.8 && < 2.13
67+ , template-haskell >= 2.8 && < 2.14
6868 , text >= 0.11 && <1.3
6969 , time >= 1 && < 1.9
7070 , transformers >= 0.3 && < 0.6
@@ -73,7 +73,7 @@ library
7373 , monad-control >= 1.0 && < 1.1
7474 , mtl >= 2.0 && < 2.3
7575 , transformers-base >= 0.3 && < 0.6
76− , resourcet >= 1.1 && < 1.2
76+ , resourcet >= 1.1 && < 1.3
7777 , scientific >= 0.3.3.0
7878 , microlens >= 0.2.0.0 && < 0.5
7979 , microlens-th >= 0.1.0.0 && < 0.5
katip/src/Katip/Monadic.hs+8
@@ -35,6 +35,7 @@ module Katip.Monadic
3535 , katipAddContext
3636 , KatipContextTState(..)
3737 , NoLoggingT
38+ , askLoggerIO
3839 ) where
3940
4041
@@ -486,3 +487,10 @@ instance MonadIO m => KatipContext (NoLoggingT m) where
486487 localKatipContext = const id
487488 getKatipNamespace = pure mempty
488489 localKatipNamespace = const id
490+
491+askLoggerIO :: (Applicative m, KatipContext m) => m (Severity -> LogStr -> IO ())
492+askLoggerIO = do
493+ ctx <- getKatipContext
494+ ns <- getKatipNamespace
495+ logEnv <- getLogEnv
496+ pure (\sev msg -> runKatipT logEnv $ logF ctx ns sev msg)