git.iko.soy/typeable/control-logger
on 464491e help sign in
4 files changed+30−10
since splitsnapshots
unifiedsplit
control-logger.cabal+6−1 src/Control/Logger.hs+4−4 src/Control/Logger/Internal.hs+6−5 stack.yaml+14
control-logger.cabal+6−1
@@ -5,6 +5,11 @@ synopsis: Logger used by all projects
55license-file: LICENSE
66build-type: Simple
77
8+flag katip
9+ default: True
10+ manual: False
11+ description: Enable Katip support
12+
813library
914 hs-source-dirs: src
1015 ghc-options: -Wall
@@ -30,7 +35,7 @@ library
3035 , text
3136 , time
3237 , unordered-containers
33− if !impl(ghcjs)
38+ if !impl(ghcjs) || !flag(katip)
3439 build-depends: katip
3540 , optparse-applicative
3641 default-language: Haskell2010
src/Control/Logger.hs+4−4
@@ -76,28 +76,28 @@ logInfoWith
7676 => Logger
7777 -> Text
7878 -> m ()
79−logInfoWith logger msg = withFrozenCallStack (logMsgWith logger Info msg)
79+logInfoWith logger msg = withFrozenCallStack (logMsgWith logger mempty Info msg)
8080
8181logDebugWith
8282 :: (MonadIO m, HasCallStack)
8383 => Logger
8484 -> Text
8585 -> m ()
86−logDebugWith logger msg = withFrozenCallStack (logMsgWith logger Debug msg)
86+logDebugWith logger msg = withFrozenCallStack (logMsgWith logger mempty Debug msg)
8787
8888logWarnWith
8989 :: (MonadIO m, HasCallStack)
9090 => Logger
9191 -> Text
9292 -> m ()
93−logWarnWith logger msg = withFrozenCallStack (logMsgWith logger Warn msg)
93+logWarnWith logger msg = withFrozenCallStack (logMsgWith logger mempty Warn msg)
9494
9595logErrorWith
9696 :: (MonadIO m, HasCallStack)
9797 => Logger
9898 -> Text
9999 -> m ()
100−logErrorWith logger msg = withFrozenCallStack (logMsgWith logger Error msg)
100+logErrorWith logger msg = withFrozenCallStack (logMsgWith logger mempty Error msg)
101101
102102-- | Log exceptions occured in computation and just ignore them.
103103tryLogError
src/Control/Logger/Internal.hs+6−5
@@ -58,16 +58,17 @@ logMsg
5858 -> m ()
5959logMsg s t = withFrozenCallStack $ do
6060 logger <- view part
61− logMsgWith logger s t
61+ logMsgWith logger mempty s t
6262
6363logMsgWith
6464 :: (MonadIO m, HasCallStack)
6565 => Logger
66+ -> Object
6667 -> LogSeverity
6768 -> Text
6869 -> m ()
69−logMsgWith logger s t =
70− liftIO $ runLogger logger callStack s t
70+logMsgWith logger extra s t =
71+ liftIO $ runLogger logger extra callStack s t
7172
72−runLogger :: Logger -> CallStack -> LogSeverity -> Text -> IO ()
73−runLogger (Logger ctx logger) = logger ctx
73+runLogger :: Logger -> Object -> CallStack -> LogSeverity -> Text -> IO ()
74+runLogger (Logger ctx logger) extra = logger (ctx <> extra)
stack.yamlnew file+14
@@ -0,0 +1,14 @@
1+resolver: lts-21.8
2+
3+packages:
4+- .
5+
6+extra-deps:
7+ - git: https://github.com/typeable/control-has.git
8+ commit: 017dd75cc5299dab13fc18812e7fe5ef6c1329ba
9+
10+ - git: https://github.com/typeable/control-has-katip.git
11+ commit: e9ac1b8d0fe17d8b3670d2fe344965756393ae09
12+
13+nix:
14+ packages: [zlib]