logging-effect-extra-handler 1.1.4 → 2.0.0
raw patch · 9 files changed
+61/−56 lines, 9 filesdep +prettyprinterdep −wl-pprint-textdep ~basedep ~logging-effectPVP ok
version bump matches the API change (PVP)
Dependencies added: prettyprinter
Dependencies removed: wl-pprint-text
Dependency ranges changed: base, logging-effect
API changes (from Hackage documentation)
- Control.Monad.Log.Extra.Handler: customTimestampHandler :: (MonadIO m, MonadMask m) => (UTCTime -> String) -> Handler m Doc -> Handler m Doc
+ Control.Monad.Log.Extra.Handler: customTimestampHandler :: (MonadIO m, MonadMask m) => (UTCTime -> String) -> Handler m (Doc ann) -> Handler m (Doc ann)
- Control.Monad.Log.Extra.Handler: dispatchHandler :: (MonadIO m, MonadMask m) => Handler m Doc -> Handler m Doc -> Handler m (WithSeverity Doc)
+ Control.Monad.Log.Extra.Handler: dispatchHandler :: (MonadIO m, MonadMask m) => Handler m (Doc ann) -> Handler m (Doc ann) -> Handler m (WithSeverity (Doc ann))
- Control.Monad.Log.Extra.Handler: iso8601Handler :: (MonadIO m, MonadMask m) => Handler m Doc -> Handler m Doc
+ Control.Monad.Log.Extra.Handler: iso8601Handler :: (MonadIO m, MonadMask m) => Handler m (Doc ann) -> Handler m (Doc ann)
- Control.Monad.Log.Extra.Handler: iso8601PlusHandler :: (MonadIO m, MonadMask m) => Handler m Doc -> Handler m Doc
+ Control.Monad.Log.Extra.Handler: iso8601PlusHandler :: (MonadIO m, MonadMask m) => Handler m (Doc ann) -> Handler m (Doc ann)
- Control.Monad.Log.Extra.Handler: rfc822Handler :: (MonadIO m, MonadMask m) => Handler m Doc -> Handler m Doc
+ Control.Monad.Log.Extra.Handler: rfc822Handler :: (MonadIO m, MonadMask m) => Handler m (Doc ann) -> Handler m (Doc ann)
- Control.Monad.Log.Extra.Handler: routeHandler :: (MonadIO m, MonadMask m) => Handler m Doc -> Handler m Doc -> (a -> Doc) -> Handler m (WithSeverity a)
+ Control.Monad.Log.Extra.Handler: routeHandler :: (MonadIO m, MonadMask m) => Handler m (Doc ann) -> Handler m (Doc ann) -> (a -> (Doc ann)) -> Handler m (WithSeverity a)
- Control.Monad.Log.Extra.Handler: withCustomHandler :: (MonadIO m, MonadMask m) => Handle -> BatchingOptions -> Float -> Int -> (Handler m Doc -> m a) -> m a
+ Control.Monad.Log.Extra.Handler: withCustomHandler :: (MonadIO m, MonadMask m) => Handle -> BatchingOptions -> Double -> Int -> (Handler m (Doc ann) -> m a) -> m a
- Control.Monad.Log.Extra.Handler: withCustomStderrHandler :: (MonadIO m, MonadMask m) => BatchingOptions -> Float -> Int -> (Handler m Doc -> m a) -> m a
+ Control.Monad.Log.Extra.Handler: withCustomStderrHandler :: (MonadIO m, MonadMask m) => BatchingOptions -> Double -> Int -> (Handler m (Doc ann) -> m a) -> m a
- Control.Monad.Log.Extra.Handler: withCustomStdoutHandler :: (MonadIO m, MonadMask m) => BatchingOptions -> Float -> Int -> (Handler m Doc -> m a) -> m a
+ Control.Monad.Log.Extra.Handler: withCustomStdoutHandler :: (MonadIO m, MonadMask m) => BatchingOptions -> Double -> Int -> (Handler m (Doc ann) -> m a) -> m a
- Control.Monad.Log.Extra.Handler: withStderrHandler :: (MonadIO m, MonadMask m) => (Handler m Doc -> m a) -> m a
+ Control.Monad.Log.Extra.Handler: withStderrHandler :: (MonadIO m, MonadMask m) => (Handler m (Doc ann) -> m a) -> m a
- Control.Monad.Log.Extra.Handler: withStdoutHandler :: (MonadIO m, MonadMask m) => (Handler m Doc -> m a) -> m a
+ Control.Monad.Log.Extra.Handler: withStdoutHandler :: (MonadIO m, MonadMask m) => (Handler m (Doc ann) -> m a) -> m a
Files
- CHANGELOG.md +5/−0
- executable/iso8601-handler.hs +2/−2
- executable/iso8601plus-handler.hs +2/−2
- executable/rfc822-handler.hs +2/−2
- executable/route-handler-with-iso8601.hs +2/−2
- executable/route-handler.hs +2/−2
- library/Control/Monad/Log/Extra/Handler.hs +22/−22
- logging-effect-extra-handler.cabal +20/−20
- package.yaml +4/−4
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Change log +## 2.0.0++* Bump upper bounds on base to 4.12 and logging-effect to 1.4+* Replace wl-pprint-text with prettyprinter 1.2.*+ ## 1.1.4 * Bump upper bound on `exceptions` from 0.10 to 0.11
executable/iso8601-handler.hs view
@@ -6,9 +6,9 @@ import Control.Monad.Log (MonadLog, WithSeverity) import qualified Control.Monad.Log as Log import qualified Control.Monad.Log.Extra.Handler as Log-import Text.PrettyPrint.Leijen.Text (Doc)+import Data.Text.Prettyprint.Doc (Doc) -app :: MonadLog (WithSeverity Doc) m => m ()+app :: MonadLog (WithSeverity (Doc ann)) m => m () app = do Log.logEmergency "GAH! All systems are down!!!" Log.logAlert "Red alert!"
executable/iso8601plus-handler.hs view
@@ -6,9 +6,9 @@ import Control.Monad.Log (MonadLog, WithSeverity) import qualified Control.Monad.Log as Log import qualified Control.Monad.Log.Extra.Handler as Log-import Text.PrettyPrint.Leijen.Text (Doc)+import Data.Text.Prettyprint.Doc (Doc) -app :: MonadLog (WithSeverity Doc) m => m ()+app :: MonadLog (WithSeverity (Doc ann)) m => m () app = do Log.logEmergency "GAH! All systems are down!!!" Log.logAlert "Red alert!"
executable/rfc822-handler.hs view
@@ -6,9 +6,9 @@ import Control.Monad.Log (MonadLog, WithSeverity) import qualified Control.Monad.Log as Log import qualified Control.Monad.Log.Extra.Handler as Log-import Text.PrettyPrint.Leijen.Text (Doc)+import Data.Text.Prettyprint.Doc (Doc) -app :: MonadLog (WithSeverity Doc) m => m ()+app :: MonadLog (WithSeverity (Doc ann)) m => m () app = do Log.logEmergency "GAH! All systems are down!!!" Log.logAlert "Red alert!"
executable/route-handler-with-iso8601.hs view
@@ -6,9 +6,9 @@ import Control.Monad.Log (MonadLog, WithSeverity) import qualified Control.Monad.Log as Log import qualified Control.Monad.Log.Extra.Handler as Log-import Text.PrettyPrint.Leijen.Text (Doc)+import Data.Text.Prettyprint.Doc (Doc) -app :: MonadLog (WithSeverity Doc) m => m ()+app :: MonadLog (WithSeverity (Doc ann)) m => m () app = do Log.logEmergency "GAH! All systems are down!!!" Log.logAlert "Red alert!"
executable/route-handler.hs view
@@ -6,9 +6,9 @@ import Control.Monad.Log (MonadLog, WithSeverity) import qualified Control.Monad.Log as Log import qualified Control.Monad.Log.Extra.Handler as Log-import Text.PrettyPrint.Leijen.Text (Doc)+import Data.Text.Prettyprint.Doc (Doc) -app :: MonadLog (WithSeverity Doc) m => m ()+app :: MonadLog (WithSeverity (Doc ann)) m => m () app = do Log.logEmergency "GAH! All systems are down!!!" Log.logAlert "Red alert!"
library/Control/Monad/Log/Extra/Handler.hs view
@@ -45,11 +45,11 @@ import qualified Data.Time as Time import System.IO (Handle) import qualified System.IO as IO-import Text.PrettyPrint.Leijen.Text (Doc)+import Data.Text.Prettyprint.Doc (Doc) -- | Converts an existing handler into a handler that renders an ISO8601 -- (i.e. YYYY-MM-DDTHH:MM:SS) timestamp on every log message.-iso8601Handler :: (MonadIO m, MonadMask m) => Handler m Doc -> Handler m Doc+iso8601Handler :: (MonadIO m, MonadMask m) => Handler m (Doc ann) -> Handler m (Doc ann) iso8601Handler = customTimestampHandler formatter where formatter = Time.formatTime Time.defaultTimeLocale "%Y-%m-%dT%H:%M:%S" @@ -57,14 +57,14 @@ -- (i.e. YYYY-MM-DDTHH:MM:SS with decimal point and fraction of second) -- timestamp on every log message. iso8601PlusHandler :: (MonadIO m, MonadMask m)- => Handler m Doc- -> Handler m Doc+ => Handler m (Doc ann)+ -> Handler m (Doc ann) iso8601PlusHandler = customTimestampHandler formatter where formatter = Time.formatTime Time.defaultTimeLocale "%Y-%m-%dT%H:%M:%S%06Q" -- | Converts an existing handler into a handler that renders an RFC822 -- timestamp on every log message.-rfc822Handler :: (MonadIO m, MonadMask m) => Handler m Doc -> Handler m Doc+rfc822Handler :: (MonadIO m, MonadMask m) => Handler m (Doc ann) -> Handler m (Doc ann) rfc822Handler = customTimestampHandler formatter where formatter = Time.formatTime Time.defaultTimeLocale Time.rfc822DateFormat @@ -72,8 +72,8 @@ -- every log message. The timestamp is formatted via the input function. customTimestampHandler :: (MonadIO m, MonadMask m) => (UTCTime -> String)- -> Handler m Doc- -> Handler m Doc+ -> Handler m (Doc ann)+ -> Handler m (Doc ann) customTimestampHandler formatter handler = \msg -> do msg' <- Log.timestamp msg handler (Log.renderWithTimestamp formatter id msg')@@ -82,9 +82,9 @@ -- and 'Debug' messages to the first input handler and routes 'Emergency', -- 'Alert', 'Critical', and 'Error' messages to the second input handler. routeHandler :: (MonadIO m, MonadMask m)- => Handler m Doc -- ^ The handler for non-error messages (i.e. stdout handler)- -> Handler m Doc -- ^ The handler for error messages (i.e. stderr handler)- -> (a -> Doc) -- ^ How to render+ => Handler m (Doc ann) -- ^ The handler for non-error messages (i.e. stdout handler)+ -> Handler m (Doc ann) -- ^ The handler for error messages (i.e. stderr handler)+ -> (a -> (Doc ann)) -- ^ How to render -> Handler m (WithSeverity a) routeHandler stdoutHandler stderrHandler renderer = \msg -> let msg' = Log.renderWithSeverity renderer msg@@ -105,36 +105,36 @@ -- This function is limiting as it assumes incoming messages are -- 'WithSeverity' 'Doc' instead of the more general 'WithSeverity' 'a'. dispatchHandler :: (MonadIO m, MonadMask m)- => Handler m Doc -- ^ The handler for non-error messages (i.e. stdout handler)- -> Handler m Doc -- ^ The handler for error messages (i.e. stderr handler)- -> Handler m (WithSeverity Doc)+ => Handler m (Doc ann) -- ^ The handler for non-error messages (i.e. stdout handler)+ -> Handler m (Doc ann) -- ^ The handler for error messages (i.e. stderr handler)+ -> Handler m (WithSeverity (Doc ann)) dispatchHandler stdoutHandler stderrHandler = routeHandler stdoutHandler stderrHandler id {-# DEPRECATED dispatchHandler "dispatchHandler is deprecated in favor of routeHandler." #-} -- | Convenience wrapper around 'Log.withFDHandler' for 'IO.stdout' with somewhat sensible defaults.-withStdoutHandler :: (MonadIO m, MonadMask m) => (Handler m Doc -> m a) -> m a+withStdoutHandler :: (MonadIO m, MonadMask m) => (Handler m (Doc ann) -> m a) -> m a withStdoutHandler = withCustomStdoutHandler Log.defaultBatchingOptions 0.4 80 -- | Convenience wrapper around 'Log.withFDHandler' for 'IO.stderr' with somewhat sensible defaults.-withStderrHandler :: (MonadIO m, MonadMask m) => (Handler m Doc -> m a) -> m a+withStderrHandler :: (MonadIO m, MonadMask m) => (Handler m (Doc ann) -> m a) -> m a withStderrHandler = withCustomStderrHandler Log.defaultBatchingOptions 0.4 80 -- | Convenience wrapper around 'Log.withFDHandler' for 'IO.stdout'. withCustomStdoutHandler :: (MonadIO m, MonadMask m) => BatchingOptions- -> Float -- ^ The @ribbonFrac@ parameter to 'Pretty.renderPretty'+ -> Double -- ^ The @ribbonFrac@ parameter to 'Pretty.renderPretty' -> Int -- ^ The amount of characters per line. Lines longer than this will be pretty-printed across multiple lines if possible.- -> (Handler m Doc -> m a)+ -> (Handler m (Doc ann) -> m a) -> m a withCustomStdoutHandler = withCustomHandler IO.stdout -- | Convenience wrapper around 'Log.withFDHandler' for 'IO.stderr'. withCustomStderrHandler :: (MonadIO m, MonadMask m) => BatchingOptions- -> Float -- ^ The @ribbonFrac@ parameter to 'Pretty.renderPretty'+ -> Double -- ^ The @ribbonFrac@ parameter to 'Pretty.renderPretty' -> Int -- ^ The amount of characters per line. Lines longer than this will be pretty-printed across multiple lines if possible.- -> (Handler m Doc -> m a)+ -> (Handler m (Doc ann) -> m a) -> m a withCustomStderrHandler = withCustomHandler IO.stderr @@ -143,9 +143,9 @@ withCustomHandler :: (MonadIO m, MonadMask m) => Handle -> BatchingOptions- -> Float -- ^ The @ribbonFrac@ parameter to 'Pretty.renderPretty'+ -> Double -- ^ The @ribbonFrac@ parameter to 'Pretty.renderPretty' -> Int -- ^ The amount of characters per line. Lines longer than this will be pretty-printed across multiple lines if possible.- -> (Handler m Doc -> m a)+ -> (Handler m (Doc ann) -> m a) -> m a withCustomHandler handle options ribbonFrac width = Log.withFDHandler options handle ribbonFrac width @@ -157,7 +157,7 @@ In the quickstart examples, please assume the following is in scope: @-app :: 'Log.MonadLog' ('WithSeverity' 'Doc') m => m ()+app :: 'Log.MonadLog' ('WithSeverity' ('Doc' ann)) m => m () app = 'Log.logWarning' "Cargo number 2331 has commandeered the vessel" @
logging-effect-extra-handler.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 4c5ba080ccc09cc4138a7cc730d5a906e61e3a14a9e714405d2d04a8c12e3a71+-- hash: 6f3a060c88d397d9c56c387c38ce56c7db521cdc0d03cd498aada2e24d73ff8b name: logging-effect-extra-handler-version: 1.1.4+version: 2.0.0 synopsis: Handy logging handler combinators description: Handy logging handler combinators. category: Other@@ -32,11 +32,11 @@ library ghc-options: -Wall build-depends:- base >=4.8 && <4.11+ base >=4.8 && <4.12 , exceptions >=0.8.0.2 && <0.11- , logging-effect >=1.1.0 && <1.3+ , logging-effect >=1.1.0 && <1.4+ , prettyprinter ==1.2.* , time >=1.5 && <1.10- , wl-pprint-text >=1.1.0.4 && <1.2 exposed-modules: Control.Monad.Log.Extra.Handler other-modules:@@ -49,10 +49,10 @@ executable ghc-options: -Wall -rtsopts -threaded -with-rtsopts=-N build-depends:- base >=4.8 && <4.11- , logging-effect >=1.1.0 && <1.3+ base >=4.8 && <4.12+ , logging-effect >=1.1.0 && <1.4 , logging-effect-extra-handler- , wl-pprint-text >=1.1.0.4 && <1.2+ , prettyprinter ==1.2.* other-modules: Paths_logging_effect_extra_handler default-language: Haskell2010@@ -63,10 +63,10 @@ executable ghc-options: -Wall -rtsopts -threaded -with-rtsopts=-N build-depends:- base >=4.8 && <4.11- , logging-effect >=1.1.0 && <1.3+ base >=4.8 && <4.12+ , logging-effect >=1.1.0 && <1.4 , logging-effect-extra-handler- , wl-pprint-text >=1.1.0.4 && <1.2+ , prettyprinter ==1.2.* other-modules: Paths_logging_effect_extra_handler default-language: Haskell2010@@ -77,10 +77,10 @@ executable ghc-options: -Wall -rtsopts -threaded -with-rtsopts=-N build-depends:- base >=4.8 && <4.11- , logging-effect >=1.1.0 && <1.3+ base >=4.8 && <4.12+ , logging-effect >=1.1.0 && <1.4 , logging-effect-extra-handler- , wl-pprint-text >=1.1.0.4 && <1.2+ , prettyprinter ==1.2.* other-modules: Paths_logging_effect_extra_handler default-language: Haskell2010@@ -91,10 +91,10 @@ executable ghc-options: -Wall -rtsopts -threaded -with-rtsopts=-N build-depends:- base >=4.8 && <4.11- , logging-effect >=1.1.0 && <1.3+ base >=4.8 && <4.12+ , logging-effect >=1.1.0 && <1.4 , logging-effect-extra-handler- , wl-pprint-text >=1.1.0.4 && <1.2+ , prettyprinter ==1.2.* other-modules: Paths_logging_effect_extra_handler default-language: Haskell2010@@ -105,10 +105,10 @@ executable ghc-options: -Wall -rtsopts -threaded -with-rtsopts=-N build-depends:- base >=4.8 && <4.11- , logging-effect >=1.1.0 && <1.3+ base >=4.8 && <4.12+ , logging-effect >=1.1.0 && <1.4 , logging-effect-extra-handler- , wl-pprint-text >=1.1.0.4 && <1.2+ , prettyprinter ==1.2.* other-modules: Paths_logging_effect_extra_handler default-language: Haskell2010
package.yaml view
@@ -1,9 +1,9 @@ author: Jason Shipman category: Other dependencies:-- base >=4.8 && <4.11-- logging-effect >= 1.1.0 && <1.3-- wl-pprint-text >=1.1.0.4 && <1.2+- base >=4.8 && <4.12+- logging-effect >= 1.1.0 && <1.4+- prettyprinter == 1.2.* description: Handy logging handler combinators. executables: route-handler:@@ -67,4 +67,4 @@ maintainer: Jason Shipman name: logging-effect-extra-handler synopsis: Handy logging handler combinators-version: '1.1.4'+version: '2.0.0'