monad-logger 0.3.22 → 0.3.23
raw patch · 3 files changed
+24/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Monad.Logger: defaultLoc :: Loc
+ Control.Monad.Logger: logWithoutLoc :: (MonadLogger m, ToLogStr msg) => LogSource -> LogLevel -> msg -> m ()
Files
- ChangeLog.md +4/−0
- Control/Monad/Logger.hs +19/−11
- monad-logger.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.3.23+* Changed `runFileLoggingT` buffering to line buffering.+* Added `defaultLog` and `logWithoutLoc` to list of exported functions.+ ## 0.3.22 * Added `runFileLoggingT`.
Control/Monad/Logger.hs view
@@ -74,6 +74,7 @@ , logErrorN , logOtherN -- * Non-TH logging with source+ , logWithoutLoc , logDebugNS , logInfoNS , logWarnNS@@ -90,6 +91,7 @@ -- * utilities for defining your own loggers , defaultLogStr , Loc (..)+ , defaultLoc ) where #if WITH_TEMPLATE_HASKELL@@ -144,7 +146,7 @@ import Data.Monoid (mappend, mempty) import System.Log.FastLogger-import System.IO (Handle, IOMode(AppendMode), openFile, hClose, stdout, stderr)+import System.IO (Handle, IOMode(AppendMode), BufferMode(LineBuffering), openFile, hClose, hSetBuffering, stdout, stderr) import Control.Monad.Cont.Class ( MonadCont (..) ) import Control.Monad.Error.Class ( MonadError (..) )@@ -210,11 +212,11 @@ -- logging function itself can be extracted as a first-class value, which can -- make it easier to manipulate monad transformer stacks, as an example. ----- Since 0.3.10+-- @since 0.3.10 class (MonadLogger m, MonadIO m) => MonadLoggerIO m where -- | Request the logging function itself. --- -- Since 0.3.10+ -- @since 0.3.10 askLoggerIO :: m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) default askLoggerIO :: (Trans.MonadTrans t, MonadLoggerIO n, m ~ t n) => m (Loc -> LogSource -> LogLevel -> LogStr -> IO ())@@ -327,7 +329,7 @@ -- | Lift a location into an Exp. ----- Since 0.3.1+-- @since 0.3.1 liftLoc :: Loc -> Q Exp liftLoc (Loc a b c (d1, d2) (e1, e2)) = [|Loc $(lift a)@@ -362,7 +364,7 @@ -- | Monad transformer that disables logging. ----- Since 0.2.4+-- @since 0.2.4 newtype NoLoggingT m a = NoLoggingT { runNoLoggingT :: m a } #if __GLASGOW_HASKELL__ < 710@@ -462,7 +464,7 @@ -- | Monad transformer that adds a new logging function. ----- Since 0.2.2+-- @since 0.2.2 newtype LoggingT m a = LoggingT { runLoggingT :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> m a } #if __GLASGOW_HASKELL__ < 710@@ -658,17 +660,17 @@ runFileLoggingT fp log = bracket (liftBase $ openFile fp AppendMode) (liftBase . hClose)- $ \h -> (runLoggingT log) (defaultOutput h)+ $ \h -> liftBase (hSetBuffering h LineBuffering) >> (runLoggingT log) (defaultOutput h) -- | Run a block using a @MonadLogger@ instance which prints to stderr. ----- Since 0.2.2+-- @since 0.2.2 runStderrLoggingT :: MonadIO m => LoggingT m a -> m a runStderrLoggingT = (`runLoggingT` defaultOutput stderr) -- | Run a block using a @MonadLogger@ instance which prints to stdout. ----- Since 0.2.2+-- @since 0.2.2 runStdoutLoggingT :: MonadIO m => LoggingT m a -> m a runStdoutLoggingT = (`runLoggingT` defaultOutput stdout) @@ -699,7 +701,7 @@ -- channel of the indicated size, and only actually log them if there is an -- exception. ----- Since 0.3.2+-- @since 0.3.2 withChannelLogger :: (MonadBaseControl IO m, MonadIO m) => Int -- ^ Number of messages to keep -> LoggingT m a@@ -720,7 +722,7 @@ -- -- This can be a convenient way, for example, to ignore debug level messages. ----- Since 0.3.13+-- @since 0.3.13 filterLogger :: (LogSource -> LogLevel -> Bool) -> LoggingT m a -> LoggingT m a@@ -769,6 +771,9 @@ listen = mapNoLoggingT listen pass = mapNoLoggingT pass +-- | dummy location, used with 'logWithoutLoc'+--+-- @since 0.3.23 defaultLoc :: Loc defaultLoc = Loc "<unknown>" "<unknown>" "<unknown>" (0,0) (0,0) @@ -776,6 +781,9 @@ isDefaultLoc (Loc "<unknown>" "<unknown>" "<unknown>" (0,0) (0,0)) = True isDefaultLoc _ = False +-- |+--+-- @since 0.3.23 logWithoutLoc :: (MonadLogger m, ToLogStr msg) => LogSource -> LogLevel -> msg -> m () logWithoutLoc = monadLoggerLog defaultLoc
monad-logger.cabal view
@@ -1,5 +1,5 @@ name: monad-logger-version: 0.3.22+version: 0.3.23 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