log-warper 1.2.1 → 1.2.2
raw patch · 3 files changed
+11/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.md +6/−0
- log-warper.cabal +1/−1
- src/System/Wlog/Handler/Simple.hs +4/−2
CHANGES.md view
@@ -1,3 +1,9 @@++1.2.2+=====++* Fixed memory leak (PR #17).+ 1.2.1 =====
log-warper.cabal view
@@ -1,5 +1,5 @@ name: log-warper-version: 1.2.1+version: 1.2.2 synopsis: Flexible, configurable, monadic and pretty logging homepage: https://github.com/serokell/log-warper license: MIT
src/System/Wlog/Handler/Simple.hs view
@@ -55,7 +55,7 @@ getLevel sh = severity sh setFormatter sh f = sh{formatter = f} getFormatter sh = formatter sh- readBack sh i = withMVar (readBackBuffer sh) $ pure . take i . MQ.toList+ readBack sh i = withMVar (readBackBuffer sh) $ \mq -> pure $! take i (MQ.toList mq) emit sh (_,msg) _ = (writeFunc sh) (privData sh) msg close sh = (closeFunc sh) (privData sh) @@ -69,7 +69,9 @@ mq <- newMVar $ MQ.newMemoryQueue $ 2 * 1024 * 1024 -- 2 MB let mywritefunc hdl msg = withMVar lock $ const $ do writeToHandle hdl msg- modifyMVar_ mq $ pure . pushFront msg+ -- Important to force the queue here, else a massive closure will+ -- be retained until the queue is actually used.+ modifyMVar_ mq $ \mq' -> pure $! pushFront msg mq' hFlush hdl return GenericHandler