yet-another-logger 0.2.2 → 0.2.3
raw patch · 5 files changed
+44/−2 lines, 5 files
Files
- CHANGELOG.md +6/−0
- src/System/Logger/Backend/Handle.hs +10/−0
- src/System/Logger/Logger/Internal.hs +13/−0
- src/System/Logger/Types.hs +13/−0
- yet-another-logger.cabal +2/−2
CHANGELOG.md view
@@ -1,3 +1,9 @@+0.2.3+=====++* Fix semantically invalid default NFData instance when build with+ deepseq <1.4.+ 0.2.2 =====
src/System/Logger/Backend/Handle.hs view
@@ -25,6 +25,7 @@ -- Stability: experimental -- +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveDataTypeable #-}@@ -61,6 +62,10 @@ , handleBackend_ ) where +#ifndef MIN_VERSION_deepseq+#define MIN_VESION_deepseq(a,b,c) 1+#endif+ import Configuration.Utils hiding (Lens', Error) import Configuration.Utils.Validation @@ -171,7 +176,12 @@ handleBackendConfigHandle ∷ Lens' HandleBackendConfig LoggerHandleConfig handleBackendConfigHandle = lens _handleBackendConfigHandle $ \a b → a { _handleBackendConfigHandle = b } +#if MIN_VERSION_deepseq(1,4,0) instance NFData HandleBackendConfig+#else+instance NFData HandleBackendConfig where+ rnf (HandleBackendConfig a0 a1) = rnf a0 `seq` rnf a1+#endif defaultHandleBackendConfig ∷ HandleBackendConfig defaultHandleBackendConfig = HandleBackendConfig
src/System/Logger/Logger/Internal.hs view
@@ -31,6 +31,7 @@ -- module as an example and starting point. -- +{-# LANGUAGE CPP #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-}@@ -78,6 +79,10 @@ , runLogT ) where +#ifndef MIN_VERSION_deepseq+#define MIN_VESION_deepseq(a,b,c) 1+#endif+ import Configuration.Utils hiding (Lens', Error) import Control.Concurrent (threadDelay)@@ -189,7 +194,15 @@ loggerConfigExitTimeout ∷ Lens' LoggerConfig (Maybe Natural) loggerConfigExitTimeout = lens _loggerConfigExitTimeout $ \a b → a { _loggerConfigExitTimeout = b } +#if MIN_VERSION_deepseq(1,4,0) instance NFData LoggerConfig+#else+instance NFData Natural where+ rnf a = a `seq` ()+instance NFData LoggerConfig where+ rnf (LoggerConfig a0 a1 a2 a3 a4 a5 a6) =+ rnf a0 `seq` rnf a1 `seq` rnf a2 `seq` rnf a3 `seq` rnf a4 `seq` rnf a5 `seq` rnf a6+#endif -- | Default Logger configuration --
src/System/Logger/Types.hs view
@@ -25,6 +25,7 @@ -- Stability: experimental -- +{-# LANGUAGE CPP #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE LambdaCase #-}@@ -89,6 +90,10 @@ ) where +#ifndef MIN_VERSION_deepseq+#define MIN_VESION_deepseq(a,b,c) 1+#endif+ import Configuration.Utils hiding (Lens, Lens', Error) import Control.DeepSeq@@ -312,8 +317,16 @@ logMsgTime ∷ Lens' (LogMessage a) TimeSpec logMsgTime = lens _logMsgTime $ \a b → a { _logMsgTime = b } +#if MIN_VERSION_deepseq(1,4,0) instance NFData TimeSpec instance NFData a ⇒ NFData (LogMessage a)+#else+instance NFData TimeSpec where+ rnf (TimeSpec a0 a1) = rnf a0 `seq` rnf a1+instance NFData a ⇒ NFData (LogMessage a) where+ rnf (LogMessage a0 a1 a2 a3) =+ rnf a0 `seq` rnf a1 `seq` rnf a2 `seq` rnf a3+#endif -- | This is given to logger when it is created. It formats and delivers -- individual log messages synchronously. The backend is called once for each
yet-another-logger.cabal view
@@ -1,5 +1,5 @@ Name: yet-another-logger-Version: 0.2.2+Version: 0.2.3 Synopsis: Yet Another Logger Description: A logging framework written with flexibility and performance@@ -73,7 +73,7 @@ type: git location: https://github.com/alephcloud/hs-yet-another-logger branch: master- tag: 0.2.2+ tag: 0.2.3 Library default-language: Haskell2010