packages feed

fast-logger 2.4.6 → 2.4.7

raw patch · 4 files changed

+16/−4 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 2.4.7++* Fixing interleaved log output when messages are larger than buffer size. [#103](https://github.com/kazu-yamamoto/logger/pull/103)+ ## 2.4.6  * Ensuring that stdio is flushed. [#92](https://github.com/kazu-yamamoto/logger/pull/92)
System/Log/FastLogger/File.hs view
@@ -9,8 +9,8 @@ -- | The spec for logging files data FileLogSpec = FileLogSpec {     log_file :: FilePath-  , log_file_size :: Integer-  , log_backup_number :: Int+  , log_file_size :: Integer -- ^ Max log file size (in bytes) before requiring rotation.+  , log_backup_number :: Int -- ^ Max number of rotated log files to keep around before overwriting the oldest one.   }  -- | Checking if a log file can be written.
System/Log/FastLogger/Logger.hs view
@@ -10,6 +10,7 @@  import Control.Concurrent (MVar, newMVar, withMVar) import Control.Monad (when)+import Foreign.Marshal.Alloc (allocaBytes) import Foreign.Ptr (plusPtr) import System.Log.FastLogger.FileIO import System.Log.FastLogger.IO@@ -35,7 +36,13 @@ pushLog fd logger@(Logger mbuf size ref) nlogmsg@(LogStr nlen nbuilder)   | nlen > size = do       flushLog fd logger-      withMVar mbuf $ \buf -> toBufIOWith buf size (write fd) nbuilder++      -- Make sure we have a large enough buffer to hold the entire+      -- contents, thereby allowing for a single write system call and+      -- avoiding interleaving. This does not address the possibility+      -- of write not writing the entire buffer at once.+      allocaBytes nlen $ \buf -> withMVar mbuf $ \_ ->+        toBufIOWith buf nlen (write fd) nbuilder   | otherwise = do     mmsg <- atomicModifyIORef' ref checkBuf     case mmsg of
fast-logger.cabal view
@@ -1,11 +1,12 @@ Name:                   fast-logger-Version:                2.4.6+Version:                2.4.7 Author:                 Kazu Yamamoto <kazu@iij.ad.jp> Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp> License:                BSD3 License-File:           LICENSE Synopsis:               A fast logging system Description:            A fast logging system+Homepage:               https://github.com/kazu-yamamoto/logger Category:               System Cabal-Version:          >= 1.8 Build-Type:             Simple