fast-logger 3.2.6 → 3.2.7
raw patch · 3 files changed
+23/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- System/Log/FastLogger.hs +18/−11
- fast-logger.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 3.2.7++* Don't eat up an asynchronous exception.+ ## 3.2.6 * Labeling the thread of SingleLogger.
System/Log/FastLogger.hs view
@@ -47,8 +47,9 @@ ) where import Control.Concurrent (MVar, newMVar, putMVar, tryTakeMVar)-import Control.Exception (SomeException (..), bracket, handle)+import Control.Exception (bracket) import System.EasyFile (getFileSize)+import qualified System.IO.Error as E import System.Log.FastLogger.Date import System.Log.FastLogger.File@@ -80,30 +81,35 @@ data LogType' a where LogNone :: LogType' LogStr -- ^ No logging.- LogStdout :: BufSize+ LogStdout+ :: BufSize -> LogType' LogStr -- ^ Logging to stdout. -- 'BufSize' is a buffer size -- for each capability.- LogStderr :: BufSize+ LogStderr+ :: BufSize -> LogType' LogStr -- ^ Logging to stderr. -- 'BufSize' is a buffer size -- for each capability.- LogFileNoRotate :: FilePath+ LogFileNoRotate+ :: FilePath -> BufSize -> LogType' LogStr -- ^ Logging to a file. -- 'BufSize' is a buffer size -- for each capability.- LogFile :: FileLogSpec+ LogFile+ :: FileLogSpec -> BufSize -> LogType' LogStr -- ^ Logging to a file. -- 'BufSize' is a buffer size -- for each capability. -- File rotation is done on-demand.- LogFileTimedRotate :: TimedFileLogSpec+ LogFileTimedRotate+ :: TimedFileLogSpec -> BufSize -> LogType' LogStr -- ^ Logging to a file.@@ -111,7 +117,8 @@ -- for each capability. -- Rotation happens based on check specified -- in 'TimedFileLogSpec'.- LogCallback :: (v -> IO ())+ LogCallback+ :: (v -> IO ()) -> IO () -> LogType' v -- ^ Logging with a log and flush action.@@ -261,11 +268,11 @@ writeIORef ref $ estimate (limit - siz) file = log_file spec limit = log_file_size spec+ -- The log file is locked by GHC.+ -- We need to get its file size by the way not using locks. getSize =- handle (\(SomeException _) -> return Nothing) $- -- The log file is locked by GHC.- -- We need to get its file size by the way not using locks.- Just . fromIntegral <$> getFileSize file+ (Just . fromIntegral <$> getFileSize file) `E.catchIOError` \_ -> return Nothing+ -- 200 is an ad-hoc value for the length of log line. estimate x = fromInteger (x `div` 200)
fast-logger.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: fast-logger-version: 3.2.6+version: 3.2.7 license: BSD3 license-file: LICENSE maintainer: Kazu Yamamoto <kazu@iij.ad.jp>