git.iko.soy/typeable/control-logger
on 464491e help sign in
control-logger.cabal+6−1
since splitsnapshots
unifiedsplit
@@ -5,6 +5,11 @@ synopsis: Logger used by all projects
5license-file: LICENSE
5license-file: LICENSE
6build-type: Simple
6build-type: Simple
7
7
8+flag katip
9+ default: True
10+ manual: False
11+ description: Enable Katip support
12+
8library
13library
9 hs-source-dirs: src
14 hs-source-dirs: src
10 ghc-options: -Wall
15 ghc-options: -Wall
@@ -30,7 +35,7 @@ library
30 , text
35 , text
31 , time
36 , time
32 , unordered-containers
37 , unordered-containers
33− if !impl(ghcjs)
38+ if !impl(ghcjs) || !flag(katip)
34 build-depends: katip
39 build-depends: katip
35 , optparse-applicative
40 , optparse-applicative
36 default-language: Haskell2010
41 default-language: Haskell2010
src/Control/Logger.hs+4−4
@@ -76,28 +76,28 @@ logInfoWith
76 => Logger
76 => Logger
77 -> Text
77 -> Text
78 -> m ()
78 -> m ()
79−logInfoWith logger msg = withFrozenCallStack (logMsgWith logger Info msg)
79+logInfoWith logger msg = withFrozenCallStack (logMsgWith logger mempty Info msg)
80
80
81logDebugWith
81logDebugWith
82 :: (MonadIO m, HasCallStack)
82 :: (MonadIO m, HasCallStack)
83 => Logger
83 => Logger
84 -> Text
84 -> Text
85 -> m ()
85 -> m ()
86−logDebugWith logger msg = withFrozenCallStack (logMsgWith logger Debug msg)
86+logDebugWith logger msg = withFrozenCallStack (logMsgWith logger mempty Debug msg)
87
87
88logWarnWith
88logWarnWith
89 :: (MonadIO m, HasCallStack)
89 :: (MonadIO m, HasCallStack)
90 => Logger
90 => Logger
91 -> Text
91 -> Text
92 -> m ()
92 -> m ()
93−logWarnWith logger msg = withFrozenCallStack (logMsgWith logger Warn msg)
93+logWarnWith logger msg = withFrozenCallStack (logMsgWith logger mempty Warn msg)
94
94
95logErrorWith
95logErrorWith
96 :: (MonadIO m, HasCallStack)
96 :: (MonadIO m, HasCallStack)
97 => Logger
97 => Logger
98 -> Text
98 -> Text
99 -> m ()
99 -> m ()
100−logErrorWith logger msg = withFrozenCallStack (logMsgWith logger Error msg)
100+logErrorWith logger msg = withFrozenCallStack (logMsgWith logger mempty Error msg)
101
101
102-- | Log exceptions occured in computation and just ignore them.
102-- | Log exceptions occured in computation and just ignore them.
103tryLogError
103tryLogError
src/Control/Logger/Internal.hs+6−5
@@ -58,16 +58,17 @@ logMsg
58 -> m ()
58 -> m ()
59logMsg s t = withFrozenCallStack $ do
59logMsg s t = withFrozenCallStack $ do
60 logger <- view part
60 logger <- view part
61− logMsgWith logger s t
61+ logMsgWith logger mempty s t
62
62
63logMsgWith
63logMsgWith
64 :: (MonadIO m, HasCallStack)
64 :: (MonadIO m, HasCallStack)
65 => Logger
65 => Logger
66+ -> Object
66 -> LogSeverity
67 -> LogSeverity
67 -> Text
68 -> Text
68 -> m ()
69 -> m ()
69−logMsgWith logger s t =
70+logMsgWith logger extra s t =
70− liftIO $ runLogger logger callStack s t
71+ liftIO $ runLogger logger extra callStack s t
71
72
72−runLogger :: Logger -> CallStack -> LogSeverity -> Text -> IO ()
73+runLogger :: Logger -> Object -> CallStack -> LogSeverity -> Text -> IO ()
73−runLogger (Logger ctx logger) = logger ctx
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]