packages feed

monad-logger 0.2.3.2 → 0.2.4

raw patch · 2 files changed

+51/−1 lines, 2 files

Files

Control/Monad/Logger.hs view
@@ -27,6 +27,7 @@     , LoggingT (..)     , runStderrLoggingT     , runStdoutLoggingT+    , NoLoggingT (..)     -- * TH logging     , logDebug     , logInfo@@ -184,6 +185,55 @@ -- > $logOther "SomeSource" "My new level" "This is a log message" logOtherS :: Q Exp logOtherS = [|\src level msg -> monadLoggerLogSource $(qLocation >>= liftLoc) src (LevelOther level) (msg :: Text)|]++-- | Monad transformer that disables logging.+--+-- Since 0.3.0+newtype NoLoggingT m a = NoLoggingT { runNoLoggingT :: m a }++instance Monad m => Functor (NoLoggingT m) where+    fmap = liftM++instance Monad m => Applicative (NoLoggingT m) where+    pure = return+    (<*>) = ap++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++instance MonadThrow m => MonadThrow (NoLoggingT m) where+    monadThrow = Trans.lift . monadThrow++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+    newtype StT NoLoggingT a = StIdent {unStIdent :: a}+    liftWith f = NoLoggingT $ f $ \(NoLoggingT t) -> liftM StIdent t+    restoreT = NoLoggingT . liftM unStIdent+    {-# INLINE liftWith #-}+    {-# INLINE restoreT #-}++instance MonadBaseControl b m => MonadBaseControl b (NoLoggingT m) where+     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++instance MonadIO m => MonadLogger (NoLoggingT m) where+    monadLoggerLog a b c = monadLoggerLogSource a empty b c+    monadLoggerLogSource _ _ _ _ = return ()  -- | Monad transformer that adds a new logging function. --
monad-logger.cabal view
@@ -1,5 +1,5 @@ name:                monad-logger-version:             0.2.3.2+version:             0.2.4 synopsis:            A class of monads which can log messages. description:         This package uses template-haskell for determining source code locations of messages. homepage:            https://github.com/kazu-yamamoto/logger