Hello community, here is the log from the commit of package ghc-monad-logger for openSUSE:Factory checked in at 2016-07-12 23:52:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-monad-logger (Old) and /work/SRC/openSUSE:Factory/.ghc-monad-logger.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-monad-logger" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-monad-logger/ghc-monad-logger.changes 2016-02-11 12:37:30.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-monad-logger.new/ghc-monad-logger.changes 2016-07-12 23:52:51.000000000 +0200 @@ -1,0 +2,6 @@ +Sun Jul 10 15:50:21 UTC 2016 - [email protected] + +- update to 0.3.1.9 +* Add CallStack-based functions and Control.Monad.Logger.CallStack module + +------------------------------------------------------------------- Old: ---- monad-logger-0.3.18.tar.gz New: ---- monad-logger-0.3.19.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-monad-logger.spec ++++++ --- /var/tmp/diff_new_pack.h46Ewh/_old 2016-07-12 23:52:52.000000000 +0200 +++ /var/tmp/diff_new_pack.h46Ewh/_new 2016-07-12 23:52:52.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-monad-logger # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 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 @@ -19,7 +19,7 @@ %global pkg_name monad-logger Name: ghc-monad-logger -Version: 0.3.18 +Version: 0.3.19 Release: 0 Summary: A class of monads which can log messages License: MIT ++++++ monad-logger-0.3.18.tar.gz -> monad-logger-0.3.19.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monad-logger-0.3.18/ChangeLog.md new/monad-logger-0.3.19/ChangeLog.md --- old/monad-logger-0.3.18/ChangeLog.md 2016-02-03 09:50:59.000000000 +0100 +++ new/monad-logger-0.3.19/ChangeLog.md 2016-07-04 08:19:53.000000000 +0200 @@ -1,3 +1,7 @@ +## 0.3.19 + +* Add CallStack-based functions and `Control.Monad.Logger.CallStack` module + ## 0.3.18 * Added logTHShow and logDebugSH, logInfoSH, etc. Accepts an argument of `Show a => a` instead of just `Text`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monad-logger-0.3.18/Control/Monad/Logger/CallStack.hs new/monad-logger-0.3.19/Control/Monad/Logger/CallStack.hs --- old/monad-logger-0.3.18/Control/Monad/Logger/CallStack.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/monad-logger-0.3.19/Control/Monad/Logger/CallStack.hs 2016-07-04 08:19:53.000000000 +0200 @@ -0,0 +1,78 @@ +-- | Log functions using CallStack support in place of Template Haskell +-- +-- @since 0.3.19 +module Control.Monad.Logger.CallStack ( + module Log + , logDebug + , logInfo + , logWarn + , logError + ) where + +import Control.Monad.Logger as Log hiding (logDebug, logError, + logInfo, logOther, logWarn) +import Data.Text (Text) +import qualified Data.Text as Text +import GHC.Stack + +-- | Logs a message with the location provided by +-- an implicit 'CallStack'. +-- +-- @since 0.3.19 +logDebug :: (HasCallStack, Log.MonadLogger m) => Text -> m () +logDebug = Log.logDebugCS callStack + +-- | See 'logDebug' +-- +-- @since 0.3.19 +logInfo :: (HasCallStack, Log.MonadLogger m) => Text -> m () +logInfo = Log.logInfoCS callStack + +-- | See 'logDebug' +-- +-- @since 0.3.19 +logWarn :: (HasCallStack, Log.MonadLogger m) => Text -> m () +logWarn = Log.logWarnCS callStack + +-- | See 'logDebug' +-- +-- @since 0.3.19 +logError :: (HasCallStack, Log.MonadLogger m) => Text -> m () +logError = Log.logErrorCS callStack + +-- | See 'logDebug' +-- +-- @since 0.3.19 +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 +logDebugSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m () +logDebugSH = Log.logDebugCS callStack . Text.pack . show + +-- | See 'logDebugSH' +-- +-- @since 0.3.19 +logInfoSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m () +logInfoSH = Log.logInfoCS callStack . Text.pack . show + +-- | See 'logDebugSH' +-- +-- @since 0.3.19 +logWarnSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m () +logWarnSH = Log.logWarnCS callStack . Text.pack . show + +-- | See 'logDebugSH' +-- +-- @since 0.3.19 +logErrorSH :: (HasCallStack, Log.MonadLogger m, Show a) => a -> m () +logErrorSH = Log.logErrorCS callStack . Text.pack . show + +-- | See 'logDebugSH' +-- +-- @since 0.3.19 +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.18/Control/Monad/Logger.hs new/monad-logger-0.3.19/Control/Monad/Logger.hs --- old/monad-logger-0.3.18/Control/Monad/Logger.hs 2016-02-03 09:50:59.000000000 +0100 +++ new/monad-logger-0.3.19/Control/Monad/Logger.hs 2016-07-04 08:19:53.000000000 +0200 @@ -1,5 +1,8 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DefaultSignatures #-} +#if WITH_CALLSTACK +{-# LANGUAGE ImplicitParams #-} +#endif #if WITH_TEMPLATE_HASKELL {-# LANGUAGE TemplateHaskell #-} #endif @@ -75,7 +78,14 @@ , logWarnNS , logErrorNS , logOtherNS - +#if WITH_CALLSTACK + -- * Callstack logging + , logDebugCS + , logInfoCS + , logWarnCS + , logErrorCS + , logOtherCS +#endif -- * utilities for defining your own loggers , defaultLogStr , Loc (..) @@ -142,6 +152,10 @@ import Control.Monad.State.Class ( MonadState (..) ) import Control.Monad.Writer.Class ( MonadWriter (..) ) +#if WITH_CALLSTACK +import GHC.Stack as GHC +#endif + import Prelude hiding (catch) #if MIN_VERSION_fast_logger(2, 1, 0) @@ -758,3 +772,65 @@ logOtherNS :: MonadLogger m => Text -> LogLevel -> Text -> m () logOtherNS = logWithoutLoc + +#if WITH_CALLSTACK +-- Callstack based logging + +mkLoggerLoc :: GHC.SrcLoc -> Loc +mkLoggerLoc loc = + Loc { loc_filename = GHC.srcLocFile loc + , loc_package = GHC.srcLocPackage loc + , loc_module = GHC.srcLocModule loc + , loc_start = ( GHC.srcLocStartLine loc + , GHC.srcLocStartCol loc) + , loc_end = ( GHC.srcLocEndLine loc + , GHC.srcLocEndCol loc) + } + +locFromCS :: GHC.CallStack -> Loc +locFromCS cs = case getCallStack cs of + ((_, loc):_) -> mkLoggerLoc loc + _ -> defaultLoc + +logCS :: (MonadLogger m, ToLogStr msg) + => GHC.CallStack + -> LogSource + -> LogLevel + -> msg + -> m () +logCS cs src lvl msg = + monadLoggerLog (locFromCS cs) src lvl msg + +-- | Logs a message with location given by 'CallStack'. +-- See 'Control.Monad.Logger.CallStack' for more convenient +-- functions for 'CallStack' based logging. +-- +-- @since 0.3.19 +logDebugCS :: MonadLogger m => GHC.CallStack -> Text -> m () +logDebugCS cs msg = logCS cs "" LevelDebug msg + +-- | See 'logDebugCS' +-- +-- @since 0.3.19 +logInfoCS :: MonadLogger m => GHC.CallStack -> Text -> m () +logInfoCS cs msg = logCS cs "" LevelInfo msg + +-- | See 'logDebugCS' +-- +-- @since 0.3.19 +logWarnCS :: MonadLogger m => GHC.CallStack -> Text -> m () +logWarnCS cs msg = logCS cs "" LevelWarn msg + +-- | See 'logDebugCS' +-- +-- @since 0.3.19 +logErrorCS :: MonadLogger m => GHC.CallStack -> Text -> m () +logErrorCS cs msg = logCS cs "" LevelError msg + +-- | See 'logDebugCS' +-- +-- @since 0.3.19 +logOtherCS :: MonadLogger m => GHC.CallStack -> LogLevel -> Text -> m () +logOtherCS cs lvl msg = logCS cs "" lvl msg + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monad-logger-0.3.18/monad-logger.cabal new/monad-logger-0.3.19/monad-logger.cabal --- old/monad-logger-0.3.18/monad-logger.cabal 2016-02-03 09:50:59.000000000 +0100 +++ new/monad-logger-0.3.19/monad-logger.cabal 2016-07-04 08:19:53.000000000 +0200 @@ -1,5 +1,5 @@ name: monad-logger -version: 0.3.18 +version: 0.3.19 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 @@ -25,6 +25,7 @@ library exposed-modules: Control.Monad.Logger + build-depends: base >= 4 && < 5 , transformers , transformers-compat >= 0.3 @@ -43,6 +44,11 @@ , bytestring , blaze-builder , exceptions + + if impl(ghc >= 8.0.1) + cpp-options: -DWITH_CALLSTACK + exposed-modules: Control.Monad.Logger.CallStack + if flag(template_haskell) build-depends: template-haskell
