git.iko.soy/typeable/control-logger
on master help sign in
Pass extra data with logMsgWith.

I want this to make possible local context without changing the entire Logger contents.

commitc83d792fac362e616ede12075532dfde2f43a0f7 authorNick <nick@typeable.io> dateThu 24 Aug 2023, 21:15 (3 years ago) parentc8bd929
1 file changed+6−5
src/Control/Logger/Internal.hs+6−5
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)