Hello community, here is the log from the commit of package ghc-monad-logger for openSUSE:Factory checked in at 2018-05-30 12:10:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-monad-logger (Old) and /work/SRC/openSUSE:Factory/.ghc-monad-logger.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-monad-logger" Wed May 30 12:10:56 2018 rev:13 rq:607840 version:0.3.28.5 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-monad-logger/ghc-monad-logger.changes 2017-06-04 01:57:54.228519486 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-monad-logger.new/ghc-monad-logger.changes 2018-05-30 12:26:26.764049408 +0200 @@ -1,0 +2,15 @@ +Mon May 14 17:02:11 UTC 2018 - [email protected] + +- Update monad-logger to version 0.3.28.5. + * Fix missing module [#1](https://github.com/snoyberg/monad-logger/issues/1) + * Compat for older GHCs [#161](https://github.com/kazu-yamamoto/logger/pull/161) + * Support for exceptions 0.9 and 0.10 [#158](https://github.com/kazu-yamamoto/logger/issues/158) + * Drop blaze-builder dependency + * Fix support for GHC 7.8 [#154](https://github.com/kazu-yamamoto/logger/pull/154) + * Added `WriterLoggingT` for collecting log lines and help with testing + * Drop backwards compat with older library versions + * Add `MonadUnliftIO` instances + * Fix some incorrect `@since` comments + * Export all CallStack log functions [#143](https://github.com/kazu-yamamoto/logger/pull/143) + +------------------------------------------------------------------- Old: ---- monad-logger-0.3.24.tar.gz New: ---- monad-logger-0.3.28.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-monad-logger.spec ++++++ --- /var/tmp/diff_new_pack.R5DIUN/_old 2018-05-30 12:26:27.480025132 +0200 +++ /var/tmp/diff_new_pack.R5DIUN/_new 2018-05-30 12:26:27.484024996 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-monad-logger # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,15 +18,14 @@ %global pkg_name monad-logger Name: ghc-%{pkg_name} -Version: 0.3.24 +Version: 0.3.28.5 Release: 0 Summary: A class of monads which can log messages License: MIT -Group: Development/Languages/Other -Url: https://hackage.haskell.org/package/%{pkg_name} +Group: Development/Libraries/Haskell +URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel -BuildRequires: ghc-blaze-builder-devel BuildRequires: ghc-bytestring-devel BuildRequires: ghc-conduit-devel BuildRequires: ghc-conduit-extra-devel @@ -45,15 +44,14 @@ BuildRequires: ghc-transformers-base-devel BuildRequires: ghc-transformers-compat-devel BuildRequires: ghc-transformers-devel -BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: ghc-unliftio-core-devel %description -Hackage documentation generation is not reliable. For up to date documentation, -please see: <http://www.stackage.org/package/monad-logger>. +A class of monads which can log messages. %package devel Summary: Haskell %{pkg_name} library development files -Group: Development/Libraries/Other +Group: Development/Libraries/Haskell Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} Requires(post): ghc-compiler = %{ghc_version} @@ -78,11 +76,9 @@ %ghc_pkg_recache %files -f %{name}.files -%defattr(-,root,root,-) -%doc LICENSE +%license LICENSE %files devel -f %{name}-devel.files -%defattr(-,root,root,-) %doc ChangeLog.md README.md %changelog ++++++ monad-logger-0.3.24.tar.gz -> monad-logger-0.3.28.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monad-logger-0.3.24/ChangeLog.md new/monad-logger-0.3.28.5/ChangeLog.md --- old/monad-logger-0.3.24/ChangeLog.md 2017-05-03 17:47:49.000000000 +0200 +++ new/monad-logger-0.3.28.5/ChangeLog.md 2018-04-15 07:44:19.000000000 +0200 @@ -1,3 +1,44 @@ +## 0.3.28.5 + +* Fix missing module [#1](https://github.com/snoyberg/monad-logger/issues/1) + +## 0.3.28.4 + +* Move to a new repo + +## 0.3.28.3 + +* Compat for older GHCs [#161](https://github.com/kazu-yamamoto/logger/pull/161) + +## 0.3.28.2 + +* Support for exceptions 0.9 and 0.10 [#158](https://github.com/kazu-yamamoto/logger/issues/158) +* Drop blaze-builder dependency + +## 0.3.28.1 + +* Fix support for GHC 7.8 [#154](https://github.com/kazu-yamamoto/logger/pull/154) + +## 0.3.28 + +* Added `WriterLoggingT` for collecting log lines and help with testing + +## 0.3.27 + +* Drop backwards compat with older library versions + +## 0.3.26 + +* Add `MonadUnliftIO` instances + +## 0.3.25.1 + +* Fix some incorrect `@since` comments + +## 0.3.25 + +* Export all CallStack log functions [#143](https://github.com/kazu-yamamoto/logger/pull/143) + ## 0.3.24 * Added `MonadReader` instance for `NoLoggingT`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monad-logger-0.3.24/Control/Monad/Logger/CallStack.hs new/monad-logger-0.3.28.5/Control/Monad/Logger/CallStack.hs --- old/monad-logger-0.3.24/Control/Monad/Logger/CallStack.hs 2016-06-30 10:00:18.000000000 +0200 +++ new/monad-logger-0.3.28.5/Control/Monad/Logger/CallStack.hs 2018-04-12 07:50:54.000000000 +0200 @@ -7,10 +7,18 @@ , logInfo , logWarn , logError + , logOther + , logDebugSH + , logInfoSH + , logWarnSH + , logErrorSH + , logOtherSH ) where -import Control.Monad.Logger as Log hiding (logDebug, logError, - logInfo, logOther, logWarn) +import Control.Monad.Logger as Log hiding (logDebug, logDebugSH, + logError, logErrorSH, logInfo, + logInfoSH, logOther, logOtherSH, + logWarn, logWarnSH) import Data.Text (Text) import qualified Data.Text as Text import GHC.Stack @@ -42,37 +50,37 @@ -- | See 'logDebug' -- --- @since 0.3.19 +-- @since 0.3.25 logOther :: (HasCallStack, Log.MonadLogger m) => Log.LogLevel -> Text -> m () logOther = Log.logOtherCS callStack -- | Logs a showable value with the location provided by -- an implicit 'CallStack'. -- --- @since 0.3.19 +-- @since 0.3.25 logDebugSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m () logDebugSH = Log.logDebugCS callStack . Text.pack . show -- | See 'logDebugSH' -- --- @since 0.3.19 +-- @since 0.3.25 logInfoSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m () logInfoSH = Log.logInfoCS callStack . Text.pack . show -- | See 'logDebugSH' -- --- @since 0.3.19 +-- @since 0.3.25 logWarnSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m () logWarnSH = Log.logWarnCS callStack . Text.pack . show -- | See 'logDebugSH' -- --- @since 0.3.19 +-- @since 0.3.25 logErrorSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m () logErrorSH = Log.logErrorCS callStack . Text.pack . show -- | See 'logDebugSH' -- --- @since 0.3.19 +-- @since 0.3.25 logOtherSH :: (HasCallStack, Log.MonadLogger m, Show a) => Log.LogLevel -> a -> m () logOtherSH lvl = Log.logOtherCS callStack lvl . Text.pack . show diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monad-logger-0.3.24/Control/Monad/Logger.hs new/monad-logger-0.3.28.5/Control/Monad/Logger.hs --- old/monad-logger-0.3.24/Control/Monad/Logger.hs 2017-05-03 17:47:49.000000000 +0200 +++ new/monad-logger-0.3.28.5/Control/Monad/Logger.hs 2018-04-12 07:50:54.000000000 +0200 @@ -1,5 +1,7 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE StandaloneDeriving #-} #if WITH_CALLSTACK {-# LANGUAGE ImplicitParams #-} #endif @@ -13,12 +15,13 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE Trustworthy #-} +{-# LANGUAGE TupleSections #-} -- | This module provides the facilities needed for a decoupled logging system. -- -- The 'MonadLogger' class is implemented by monads that give access to a -- logging facility. If you're defining a custom monad, then you may define an -- instance of 'MonadLogger' that routes the log messages to the appropriate --- place (e.g., that's what @yesod-core@'s @GHandler@ does). Otherwise, you +-- place (e.g., that's what @yesod-core@'s @HandlerT@ does). Otherwise, you -- may use the 'LoggingT' monad included in this module (see -- 'runStderrLoggingT'). To simply discard log message, use 'NoLoggingT'. -- @@ -35,7 +38,7 @@ -- * Re-export from fast-logger , LogStr , ToLogStr(..) - -- * Helper transformer + -- * Helper transformers , LoggingT (..) , runStderrLoggingT , runStdoutLoggingT @@ -45,6 +48,9 @@ , withChannelLogger , filterLogger , NoLoggingT (..) + , WriterLoggingT (..) + , execWriterLoggingT + , runWriterLoggingT #if WITH_TEMPLATE_HASKELL -- * TH logging , logDebug @@ -98,29 +104,28 @@ import Language.Haskell.TH.Syntax (Lift (lift), Q, Exp, Loc (..), qLocation) #endif +import Data.Functor ((<$>)) import Data.Monoid (Monoid) -import Control.Applicative (Applicative (..)) +import Control.Applicative (Applicative (..), WrappedMonad(..)) import Control.Concurrent.Chan (Chan(),writeChan,readChan) import Control.Concurrent.STM import Control.Concurrent.STM.TBChan import Control.Exception.Lifted (onException, bracket) import Control.Monad (liftM, ap, when, void, forever) -import Control.Monad.Base (MonadBase (liftBase)) +import Control.Monad.Base (MonadBase (liftBase), liftBaseDefault) +import Control.Monad.IO.Unlift import Control.Monad.Loops (untilM) -import Control.Monad.Trans.Control (MonadBaseControl (..), MonadTransControl (..)) +import Control.Monad.Trans.Control (MonadBaseControl (..), MonadTransControl (..), ComposeSt, defaultLiftBaseWith, defaultRestoreM) import qualified Control.Monad.Trans.Class as Trans import Control.Monad.IO.Class (MonadIO (liftIO)) -import Control.Monad.Trans.Resource (MonadResource (liftResourceT), MonadThrow, monadThrow) -#if MIN_VERSION_resourcet(1,1,0) -import Control.Monad.Trans.Resource (throwM) -import Control.Monad.Catch (MonadCatch (..) -#if MIN_VERSION_exceptions(0,6,0) - , MonadMask (..) -#endif - ) +import Control.Monad.Trans.Resource (MonadResource (liftResourceT)) +import Control.Monad.Catch (MonadThrow (..), MonadCatch (..), MonadMask (..) +#if MIN_VERSION_exceptions(0, 10, 0) + , ExitCase (..) #endif + ) import Control.Monad.Trans.Identity ( IdentityT) import Control.Monad.Trans.List ( ListT ) @@ -161,18 +166,7 @@ import Prelude hiding (catch) -#if MIN_VERSION_fast_logger(2, 1, 0) --- Using System.Log.FastLogger -#elif MIN_VERSION_bytestring(0, 10, 2) -import qualified Data.ByteString.Lazy as L -import Data.ByteString.Builder (toLazyByteString) -#else -import Blaze.ByteString.Builder (toByteString) -#endif - -#if MIN_VERSION_conduit_extra(1,1,0) import Data.Conduit.Lazy (MonadActive, monadActive) -#endif data LogLevel = LevelDebug | LevelInfo | LevelWarn | LevelError | LevelOther Text deriving (Eq, Prelude.Show, Prelude.Read, Ord) @@ -366,102 +360,162 @@ -- -- @since 0.2.4 newtype NoLoggingT m a = NoLoggingT { runNoLoggingT :: m a } + deriving (Functor, Applicative, Monad, MonadIO, MonadThrow, MonadCatch, MonadMask, MonadActive, MonadBase b) -#if __GLASGOW_HASKELL__ < 710 -instance Monad m => Functor (NoLoggingT m) where - fmap = liftM - -instance Monad m => Applicative (NoLoggingT m) where - pure = return - (<*>) = ap -#else -instance Functor m => Functor (NoLoggingT m) where - fmap f = NoLoggingT . fmap f . runNoLoggingT - {-# INLINE fmap #-} - -instance Applicative m => Applicative (NoLoggingT m) where - pure = NoLoggingT . pure - {-# INLINE pure #-} - f <*> a = NoLoggingT (runNoLoggingT f <*> runNoLoggingT a) - {-# INLINE (<*>) #-} -#endif - -instance Monad m => Monad (NoLoggingT m) where - return = NoLoggingT . return - NoLoggingT ma >>= f = NoLoggingT $ ma >>= runNoLoggingT . f - -instance MonadIO m => MonadIO (NoLoggingT m) where - liftIO = Trans.lift . liftIO - -#if MIN_VERSION_resourcet(1,1,0) -instance MonadThrow m => MonadThrow (NoLoggingT m) where - throwM = Trans.lift . throwM - -instance MonadCatch m => MonadCatch (NoLoggingT m) where - catch (NoLoggingT m) c = - NoLoggingT $ m `catch` \e -> runNoLoggingT (c e) -#if MIN_VERSION_exceptions(0,6,0) -instance MonadMask m => MonadMask (NoLoggingT m) where -#endif - mask a = NoLoggingT $ mask $ \u -> runNoLoggingT (a $ q u) - where q u (NoLoggingT b) = NoLoggingT $ u b - uninterruptibleMask a = - NoLoggingT $ uninterruptibleMask $ \u -> runNoLoggingT (a $ q u) - where q u (NoLoggingT b) = NoLoggingT $ u b -#else -instance MonadThrow m => MonadThrow (NoLoggingT m) where - monadThrow = Trans.lift . monadThrow -#endif +-- For some reason GND is a fool on GHC 7.10 and older, we have to help it by providing the context explicitly. +deriving instance MonadResource m => MonadResource (NoLoggingT m) -#if MIN_VERSION_conduit_extra(1,1,0) -instance MonadActive m => MonadActive (NoLoggingT m) where - monadActive = Trans.lift monadActive instance MonadActive m => MonadActive (LoggingT m) where monadActive = Trans.lift monadActive -#endif - -instance MonadResource m => MonadResource (NoLoggingT m) where - liftResourceT = Trans.lift . liftResourceT - -instance MonadBase b m => MonadBase b (NoLoggingT m) where - liftBase = Trans.lift . liftBase instance Trans.MonadTrans NoLoggingT where lift = NoLoggingT instance MonadTransControl NoLoggingT where -#if MIN_VERSION_monad_control(1,0,0) type StT NoLoggingT a = a liftWith f = NoLoggingT $ f runNoLoggingT restoreT = NoLoggingT -#else - newtype StT NoLoggingT a = StIdent {unStIdent :: a} - liftWith f = NoLoggingT $ f $ \(NoLoggingT t) -> liftM StIdent t - restoreT = NoLoggingT . liftM unStIdent -#endif {-# INLINE liftWith #-} {-# INLINE restoreT #-} instance MonadBaseControl b m => MonadBaseControl b (NoLoggingT m) where -#if MIN_VERSION_monad_control(1,0,0) type StM (NoLoggingT m) a = StM m a liftBaseWith f = NoLoggingT $ liftBaseWith $ \runInBase -> f $ runInBase . runNoLoggingT restoreM = NoLoggingT . restoreM -#else - newtype StM (NoLoggingT m) a = StMT' (StM m a) - liftBaseWith f = NoLoggingT $ - liftBaseWith $ \runInBase -> - f $ liftM StMT' . runInBase . (\(NoLoggingT r) -> r) - restoreM (StMT' base) = NoLoggingT $ restoreM base -#endif instance Monad m => MonadLogger (NoLoggingT m) where monadLoggerLog _ _ _ _ = return () instance MonadIO m => MonadLoggerIO (NoLoggingT m) where askLoggerIO = return $ \_ _ _ _ -> return () +-- | @since 0.3.26 +instance MonadUnliftIO m => MonadUnliftIO (NoLoggingT m) where + askUnliftIO = NoLoggingT $ + withUnliftIO $ \u -> + return (UnliftIO (unliftIO u . runNoLoggingT)) + +-- | @since 0.3.28 +type LogLine = (Loc, LogSource, LogLevel, LogStr) + +-- | @since 0.3.28 +newtype WriterLoggingT m a = WriterLoggingT { unWriterLoggingT :: m (a, DList LogLine) } + +-- | Simple implementation of a difference list to support WriterLoggingT +newtype DList a = DList { unDList :: [a] -> [a] } + +emptyDList :: DList a +emptyDList = DList id + +singleton :: a -> DList a +singleton = DList . (:) + +dListToList :: DList a -> [a] +dListToList (DList dl) = dl [] + +appendDList :: DList a -> DList a -> DList a +appendDList dl1 dl2 = DList (unDList dl1 . unDList dl2) + +-- | Run a block using a @MonadLogger@ instance. Return a value and logs in a list +-- | @since 0.3.28 +runWriterLoggingT :: Functor m => WriterLoggingT m a -> m (a, [LogLine]) +runWriterLoggingT (WriterLoggingT ma) = fmap dListToList <$> ma + +-- | Run a block using a @MonadLogger@ instance. Return logs in a list +-- | @since 0.3.28 +execWriterLoggingT :: Functor m => WriterLoggingT m a -> m [LogLine] +execWriterLoggingT ma = snd <$> runWriterLoggingT ma + +instance Monad m => Monad (WriterLoggingT m) where + return = unwrapMonad . pure + (WriterLoggingT ma) >>= f = WriterLoggingT $ do + (a, msgs) <- ma + (a', msgs') <- unWriterLoggingT $ f a + return (a', appendDList msgs msgs') + +instance Applicative m => Applicative (WriterLoggingT m) where + pure a = WriterLoggingT . pure $ (a, emptyDList) + WriterLoggingT mf <*> WriterLoggingT ma = WriterLoggingT $ + fmap (\((f, msgs), (a, msgs')) -> (f a, appendDList msgs msgs')) ((,) <$> mf <*> ma) + +instance Functor m => Functor (WriterLoggingT m) where + fmap f (WriterLoggingT ma) = WriterLoggingT $ + fmap (\(a, msgs) -> (f a, msgs)) ma + +instance Monad m => MonadLogger (WriterLoggingT m) where + monadLoggerLog loc source level msg = WriterLoggingT . return $ ((), singleton (loc, source, level, toLogStr msg)) + + +instance Trans.MonadTrans WriterLoggingT where + lift ma = WriterLoggingT $ (, emptyDList) `liftM` ma + +instance MonadIO m => MonadIO (WriterLoggingT m) where + liftIO ioa = WriterLoggingT $ (, emptyDList) `liftM` liftIO ioa + +instance MonadBase b m => MonadBase b (WriterLoggingT m) where + liftBase = liftBaseDefault + +instance MonadTransControl WriterLoggingT where + type StT WriterLoggingT a = (a, DList LogLine) + liftWith f = WriterLoggingT $ liftM (\x -> (x, emptyDList)) + (f $ unWriterLoggingT) + restoreT = WriterLoggingT + +instance MonadBaseControl b m => MonadBaseControl b (WriterLoggingT m) where + type StM (WriterLoggingT m) a = ComposeSt WriterLoggingT m a + liftBaseWith = defaultLiftBaseWith + restoreM = defaultRestoreM + +instance MonadThrow m => MonadThrow (WriterLoggingT m) where + throwM = Trans.lift . throwM + +instance MonadCatch m => MonadCatch (WriterLoggingT m) where + catch (WriterLoggingT m) c = + WriterLoggingT $ m `catch` \e -> unWriterLoggingT (c e) + +instance MonadMask m => MonadMask (WriterLoggingT m) where + mask a = WriterLoggingT $ (mask $ \ u -> unWriterLoggingT (a $ q u)) + where q u b = WriterLoggingT $ u (unWriterLoggingT b) + + uninterruptibleMask a = WriterLoggingT $ uninterruptibleMask $ \u -> unWriterLoggingT (a $ q u) + where q u b = WriterLoggingT $ u (unWriterLoggingT b) + +#if MIN_VERSION_exceptions(0, 10, 0) + generalBracket acquire release use = WriterLoggingT $ do + ((b, _w12), (c, w123)) <- generalBracket + (unWriterLoggingT acquire) + (\(resource, w1) exitCase -> case exitCase of + ExitCaseSuccess (b, w12) -> do + (c, w3) <- unWriterLoggingT (release resource (ExitCaseSuccess b)) + return (c, appendDList w12 w3) + -- In the two other cases, the base monad overrides @use@'s state + -- changes and the state reverts to @w1@. + ExitCaseException e -> do + (c, w3) <- unWriterLoggingT (release resource (ExitCaseException e)) + return (c, appendDList w1 w3) + ExitCaseAbort -> do + (c, w3) <- unWriterLoggingT (release resource ExitCaseAbort) + return (c, appendDList w1 w3)) + (\(resource, w1) -> do + (a, w2) <- unWriterLoggingT (use resource) + return (a, appendDList w1 w2)) + return ((b, c), w123) +#elif MIN_VERSION_exceptions(0, 9, 0) + generalBracket acquire release releaseEx use = + WriterLoggingT $ generalBracket + (unWriterLoggingT acquire) + (\(x, w1) -> do + (y, w2) <- unWriterLoggingT (release x) + return (y, appendDList w1 w2)) + (\(x, w1) ex -> do + (y, w2) <- unWriterLoggingT (releaseEx x ex) + return (y, appendDList w1 w2)) + (\(x, w1) -> do + (y, w2) <- unWriterLoggingT (use x) + return (y, appendDList w1 w2)) +#endif + -- | Monad transformer that adds a new logging function. -- -- @since 0.2.2 @@ -498,23 +552,30 @@ instance MonadIO m => MonadIO (LoggingT m) where liftIO = Trans.lift . liftIO -#if MIN_VERSION_resourcet(1,1,0) instance MonadThrow m => MonadThrow (LoggingT m) where throwM = Trans.lift . throwM instance MonadCatch m => MonadCatch (LoggingT m) where catch (LoggingT m) c = LoggingT $ \r -> m r `catch` \e -> runLoggingT (c e) r -#if MIN_VERSION_exceptions(0,6,0) instance MonadMask m => MonadMask (LoggingT m) where -#endif mask a = LoggingT $ \e -> mask $ \u -> runLoggingT (a $ q u) e where q u (LoggingT b) = LoggingT (u . b) uninterruptibleMask a = LoggingT $ \e -> uninterruptibleMask $ \u -> runLoggingT (a $ q u) e where q u (LoggingT b) = LoggingT (u . b) -#else -instance MonadThrow m => MonadThrow (LoggingT m) where - monadThrow = Trans.lift . monadThrow +#if MIN_VERSION_exceptions(0, 10, 0) + generalBracket acquire release use = + LoggingT $ \e -> generalBracket + (runLoggingT acquire e) + (\x ec -> runLoggingT (release x ec) e) + (\x -> runLoggingT (use x) e) +#elif MIN_VERSION_exceptions(0, 9, 0) + generalBracket acquire release releaseEx use = + LoggingT $ \e -> generalBracket + (runLoggingT acquire e) + (\x -> runLoggingT (release x) e) + (\x y -> runLoggingT (releaseEx x y) e) + (\x -> runLoggingT (use x) e) #endif instance MonadResource m => MonadResource (LoggingT m) where @@ -527,38 +588,30 @@ lift = LoggingT . const instance MonadTransControl LoggingT where -#if MIN_VERSION_monad_control(1,0,0) type StT LoggingT a = a liftWith f = LoggingT $ \r -> f $ \(LoggingT t) -> t r restoreT = LoggingT . const -#else - newtype StT LoggingT a = StReader {unStReader :: a} - liftWith f = LoggingT $ \r -> f $ \(LoggingT t) -> liftM StReader $ t r - restoreT = LoggingT . const . liftM unStReader -#endif {-# INLINE liftWith #-} {-# INLINE restoreT #-} instance MonadBaseControl b m => MonadBaseControl b (LoggingT m) where -#if MIN_VERSION_monad_control(1,0,0) type StM (LoggingT m) a = StM m a liftBaseWith f = LoggingT $ \reader' -> liftBaseWith $ \runInBase -> f $ runInBase . (\(LoggingT r) -> r reader') restoreM = LoggingT . const . restoreM -#else - newtype StM (LoggingT m) a = StMT (StM m a) - liftBaseWith f = LoggingT $ \reader' -> - liftBaseWith $ \runInBase -> - f $ liftM StMT . runInBase . (\(LoggingT r) -> r reader') - restoreM (StMT base) = LoggingT $ const $ restoreM base -#endif instance MonadIO m => MonadLogger (LoggingT m) where monadLoggerLog a b c d = LoggingT $ \f -> liftIO $ f a b c (toLogStr d) instance MonadIO m => MonadLoggerIO (LoggingT m) where askLoggerIO = LoggingT return +-- | @since 0.3.26 +instance MonadUnliftIO m => MonadUnliftIO (LoggingT m) where + askUnliftIO = LoggingT $ \f -> + withUnliftIO $ \u -> + return (UnliftIO (unliftIO u . flip runLoggingT f)) + defaultOutput :: Handle -> Loc -> LogSource @@ -577,13 +630,7 @@ defaultLogStrBS a b c d = toBS $ defaultLogStr a b c d where -#if MIN_VERSION_fast_logger(2, 1, 0) toBS = fromLogStr -#elif MIN_VERSION_bytestring(0, 10, 2) - toBS = L.toStrict . toLazyByteString . logStrBuilder -#else - toBS = toByteString . logStrBuilder -#endif defaultLogLevelStr :: LogLevel -> LogStr defaultLogLevelStr level = case level of @@ -594,13 +641,8 @@ -> LogSource -> LogLevel -> LogStr -#if MIN_VERSION_fast_logger(0, 2, 0) -> LogStr -#else - -> S8.ByteString -#endif defaultLogStr loc src level msg = -#if MIN_VERSION_fast_logger(0, 2, 0) "[" `mappend` defaultLogLevelStr level `mappend` (if T.null src then mempty @@ -613,24 +655,6 @@ " @(" `mappend` toLogStr (S8.pack fileLocStr) `mappend` ")\n") -#else - S8.concat - [ S8.pack "[" - , case level of - LevelOther t -> encodeUtf8 t - _ -> encodeUtf8 $ pack $ drop 5 $ show level - , if T.null src - then S8.empty - else encodeUtf8 $ '#' `T.cons` src - , S8.pack "] " - , case msg of - LS s -> encodeUtf8 $ pack s - LB b -> b - , S8.pack " @(" - , encodeUtf8 $ pack fileLocStr - , S8.pack ")\n" - ] -#endif where -- taken from file-location package -- turn the TH Loc loaction information into a human readable string @@ -681,7 +705,7 @@ -- or a custom extraction funtion, and written to a destination. -- -- @since 0.3.17 -runChanLoggingT :: MonadIO m => Chan (Loc, LogSource, LogLevel, LogStr) -> LoggingT m a -> m a +runChanLoggingT :: MonadIO m => Chan LogLine -> LoggingT m a -> m a runChanLoggingT chan = (`runLoggingT` sink chan) where sink chan loc src lvl msg = writeChan chan (loc,src,lvl,msg) @@ -692,7 +716,7 @@ -- For use in a dedicated thread with a channel fed by `runChanLoggingT`. -- -- @since 0.3.17 -unChanLoggingT :: (MonadLogger m, MonadIO m) => Chan (Loc, LogSource, LogLevel, LogStr) -> m void +unChanLoggingT :: (MonadLogger m, MonadIO m) => Chan LogLine -> m void unChanLoggingT chan = forever $ do (loc,src,lvl,msg) <- liftIO $ readChan chan monadLoggerLog loc src lvl msg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monad-logger-0.3.24/README.md new/monad-logger-0.3.28.5/README.md --- old/monad-logger-0.3.24/README.md 2016-06-29 07:38:31.000000000 +0200 +++ new/monad-logger-0.3.28.5/README.md 2018-04-12 07:58:19.000000000 +0200 @@ -1,5 +1,8 @@ ## monad-logger +[](https://travis-ci.org/snoyberg/monad-logger) +[](https://ci.appveyor.com/project/snoyberg/monad-logger/branch/master) + A monad transformer approach for logging. This package provides Template Haskell functions for determining source code locations of messages. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monad-logger-0.3.24/monad-logger.cabal new/monad-logger-0.3.28.5/monad-logger.cabal --- old/monad-logger-0.3.24/monad-logger.cabal 2017-05-03 17:47:49.000000000 +0200 +++ new/monad-logger-0.3.28.5/monad-logger.cabal 2018-04-15 07:44:45.000000000 +0200 @@ -1,56 +1,66 @@ -name: monad-logger -version: 0.3.24 -synopsis: A class of monads which can log messages. -description: Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/monad-logger>. -homepage: https://github.com/kazu-yamamoto/logger -license: MIT -license-file: LICENSE -author: Michael Snoyman -maintainer: [email protected] -category: System -build-type: Simple -cabal-version: >=1.8 -extra-source-files: ChangeLog.md - README.md +-- This file has been generated from package.yaml by hpack version 0.28.2. +-- +-- see: https://github.com/sol/hpack +-- +-- hash: 644971c2e3a8b674be26bf61a395f47da2e2108f1017dccc2a40b4a1b9847ef9 + +name: monad-logger +version: 0.3.28.5 +synopsis: A class of monads which can log messages. +description: See README and Haddocks at <https://www.stackage.org/package/monad-logger> +category: System +homepage: https://github.com/snoyberg/monad-logger#readme +bug-reports: https://github.com/snoyberg/monad-logger/issues +author: Michael Snoyman +maintainer: [email protected] +license: MIT +license-file: LICENSE +build-type: Simple +cabal-version: >= 1.10 +extra-source-files: + ChangeLog.md + README.md source-repository head - type: git - location: https://github.com/kazu-yamamoto/logger.git + type: git + location: https://github.com/snoyberg/monad-logger -flag template_haskell { - Description: Enable Template Haskell support - Default: True - Manual: True -} +flag template_haskell + description: Enable Template Haskell support + manual: True + default: True library - exposed-modules: Control.Monad.Logger - - build-depends: base >= 4 && < 5 - , transformers - , transformers-compat >= 0.3 - , text - , stm - , stm-chans - , lifted-base - , resourcet >= 0.4 && < 1.2 - , conduit >= 1.0 && < 1.3 - , conduit-extra >= 1.0 && < 1.3 - , fast-logger >= 2.0 && < 2.5 - , transformers-base - , monad-control - , monad-loops - , mtl - , bytestring - , blaze-builder - , exceptions - - if impl(ghc >= 8.0.1) - cpp-options: -DWITH_CALLSTACK - exposed-modules: Control.Monad.Logger.CallStack - + exposed-modules: + Control.Monad.Logger + other-modules: + Paths_monad_logger + build-depends: + base >=4.8 && <5 + , bytestring >=0.10.2 + , conduit >=1.0 && <1.4 + , conduit-extra >=1.1 && <1.4 + , exceptions >=0.6 && <0.11 + , fast-logger >=2.1 && <2.5 + , lifted-base + , monad-control >=1.0 + , monad-loops + , mtl + , resourcet >=1.1 && <1.3 + , stm + , stm-chans + , text + , transformers + , transformers-base + , transformers-compat >=0.3 + , unliftio-core + if impl(ghc >=8.0.1) + exposed-modules: + Control.Monad.Logger.CallStack + cpp-options: -DWITH_CALLSTACK if flag(template_haskell) - build-depends: template-haskell - + build-depends: + template-haskell if flag(template_haskell) - cpp-options: -DWITH_TEMPLATE_HASKELL + cpp-options: -DWITH_TEMPLATE_HASKELL + default-language: Haskell2010
