packages feed

hslogger 1.2.10 → 1.2.12

raw patch · 3 files changed

+13/−12 lines, 3 filesdep ~basedep ~containersdep ~timePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, containers, time

API changes (from Hackage documentation)

- System.Log.Handler: class LogHandler a where getFormatter h = nullFormatter handle h (pri, msg) logname = if pri >= (getLevel h) then do { formattedMsg <- (getFormatter h) h (pri, msg) logname; emit h (pri, formattedMsg) logname } else return ()
+ System.Log.Handler: class LogHandler a
- System.Log.Handler.Simple: GenericHandler :: Priority -> LogFormatter (GenericHandler a) -> a -> (a -> String -> IO ()) -> (a -> IO ()) -> GenericHandler a
+ System.Log.Handler.Simple: GenericHandler :: Priority -> LogFormatter (GenericHandler a) -> a -> a -> String -> IO () -> a -> IO () -> GenericHandler a

Files

hslogger.cabal view
@@ -1,10 +1,10 @@ Name: hslogger-Version: 1.2.10+Version: 1.2.12 License: BSD3 Maintainer: John Goerzen <jgoerzen@complete.org> Author: John Goerzen Stability: Stable-Copyright: Copyright (c) 2004-2012 John Goerzen+Copyright: Copyright (c) 2004-2018 John Goerzen license-file: LICENSE build-type: Simple Homepage: http://software.complete.org/hslogger
src/System/Log/Handler/Simple.hs view
@@ -3,7 +3,7 @@    Copyright  : Copyright (C) 2004-2011 John Goerzen    License    : BSD3 -   Maintainer : John Goerzen <jgoerzen@complete.org> +   Maintainer : John Goerzen <jgoerzen@complete.org>    Stability  : provisional    Portability: portable @@ -17,16 +17,14 @@                                       verboseStreamHandler)     where -#if !MIN_VERSION_base(4,6,0)-import Prelude hiding (catch)-#endif-import Control.Exception (SomeException, catch)+import Control.Exception (SomeException, tryJust) import Data.Char (ord)  import System.Log import System.Log.Handler import System.Log.Formatter import System.IO+import System.IO.Error import Control.Concurrent.MVar  {- | A helper data type. -}@@ -64,9 +62,12 @@                                writeFunc = mywritefunc,                                closeFunc = \x -> return ()})     where-      writeToHandle hdl msg =-          hPutStrLn hdl msg `catch` (handleWriteException hdl msg)-      handleWriteException :: Handle -> String -> SomeException -> IO ()+      writeToHandle hdl msg = do+          rv <- tryJust myException (hPutStrLn hdl msg)+          either (handleWriteException hdl msg) return rv+      myException e+          | isDoesNotExistError e = Just e+          | otherwise = Nothing       handleWriteException hdl msg e =           let msg' = "Error writing log message: " ++ show e ++                      " (original message: " ++ msg ++ ")"
src/System/Log/Logger.hs view
@@ -472,11 +472,11 @@     do l <- getLogger ln        saveGlobalLogger (func l) --- | Allow gracefull shutdown. Release all opened files/handlers/etc.+-- | Allow graceful shutdown. Release all opened files/handlers/etc. removeAllHandlers :: IO () removeAllHandlers =     modifyMVar_ logTree $ \lt -> do-        let allHandlers = Map.fold (\l r -> concat [r, handlers l]) [] lt+        let allHandlers = Map.foldr (\l r -> concat [r, handlers l]) [] lt         mapM_ (\(HandlerT h) -> close h) allHandlers         return $ Map.map (\l -> l {handlers = []}) lt