simple-log 0.3.1 → 0.3.2
raw patch · 4 files changed
+15/−18 lines, 4 filesdep −old-localedep ~basedep ~containersdep ~deepseq
Dependencies removed: old-locale
Dependency ranges changed: base, containers, deepseq, directory, filepath, mtl, time, transformers
Files
- simple-log.cabal +8/−9
- src/System/Log/Simple/Config.hs +2/−3
- src/System/Log/Simple/Monad.hs +5/−5
- src/System/Log/Simple/Text.hs +0/−1
simple-log.cabal view
@@ -1,5 +1,5 @@ Name: simple-log -Version: 0.3.1 +Version: 0.3.2 Synopsis: Simple log for Haskell Description: Log library for Haskell with removing unnecessary traces License: BSD3 @@ -16,17 +16,16 @@ HS-Source-Dirs: src Build-Depends: base >= 4.0 && < 6, - containers >= 0.3 && < 0.6, - deepseq >= 1.3 && < 1.4, - directory >= 1.1 && < 1.3, - filepath >= 1.0 && < 1.4, + containers >= 0.5 && < 0.6, + deepseq >= 1.4 && < 1.5, + directory >= 1.2 && < 1.3, + filepath >= 1.4 && < 1.5, MonadCatchIO-transformers >= 0.2 && < 0.4, - mtl >= 2.0 && < 2.2, - old-locale >= 1.0 && < 1.1, + mtl >= 2.2 && < 2.3, SafeSemaphore >= 0.9.0 && < 1.0.0, text >= 0.11.0 && < 2.0.0, - time >= 1.3 && < 1.5, - transformers >= 0.2 && < 0.4 + time >= 1.5 && < 1.6, + transformers >= 0.4 && < 0.5 Exposed-Modules: System.Log.Simple System.Log.Simple.Base
src/System/Log/Simple/Config.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE OverloadedStrings, FlexibleContexts #-} module System.Log.Simple.Config ( parseRule, parseRules, @@ -6,11 +6,10 @@ constant, mvar, fileCfg ) where -import Control.Applicative import Control.Arrow import Control.Concurrent import Control.Exception -import Control.Monad.Error +import Control.Monad.Except import Control.Monad.Writer import Data.Either import Data.Text (Text)
src/System/Log/Simple/Monad.hs view
@@ -22,7 +22,7 @@ import Control.Concurrent.MSem import Control.Monad.IO.Class import Control.Monad.Reader -import Control.Monad.Error +import Control.Monad.Except import Control.Monad.CatchIO as C import Data.String import Data.Text (Text) @@ -77,7 +77,7 @@ -- | Scope with log exceptions from 'MonadError' -- | Workaround: we must explicitely post 'LeaveScope' -scopeM :: (Error e, Show e, MonadLog m, MonadError e m) => Text -> m a -> m a +scopeM :: (Show e, MonadLog m, MonadError e m) => Text -> m a -> m a scopeM s act = scopeM_ s $ C.catch act' onError' where onError' :: (MonadLog m) => SomeException -> m a onError' e = logE e >> throw e @@ -94,7 +94,7 @@ log Trace $ T.concat ["Scope ", s, " leaves with result: ", fromString . show $ r] return r -scoperM :: (Error e, Show e, Show a, MonadLog m, MonadError e m) => Text -> m a -> m a +scoperM :: (Show e, Show a, MonadLog m, MonadError e m) => Text -> m a -> m a scoperM s act = do r <- scopeM s act log Trace $ T.concat ["Scope", s, " leaves with result: ", fromString . show $ r] @@ -107,9 +107,9 @@ onError _ = return () -- | Ignore MonadError error -ignoreErrorM :: (Error e, MonadLog m, MonadError e m) => m () -> m () +ignoreErrorM :: (MonadLog m, MonadError e m) => m () -> m () ignoreErrorM act = catchError act onError where - onError :: (Error e, MonadLog m, MonadError e m) => e -> m () + onError :: (MonadLog m, MonadError e m) => e -> m () onError _ = return () -- | Trace value
src/System/Log/Simple/Text.hs view
@@ -6,7 +6,6 @@ import Data.Text (Text) import qualified Data.Text as T import Data.Time -import System.Locale import System.Log.Simple.Base -- | Default time format