packages feed

yet-another-logger 0.2.3.1 → 0.3.0

raw patch · 9 files changed

+139/−147 lines, 9 filesdep +exceptionsdep +old-localedep −eitherdep −tracedep ~time

Dependencies added: exceptions, old-locale

Dependencies removed: either, trace

Dependency ranges changed: time

Files

CHANGELOG.md view
@@ -1,3 +1,18 @@+0.3.0+=====++*   Remove `EitherT` instance. It's recommended to use `ExceptT` instead.++*   Remove `TraceT` instace. It's not actively maintained any more.++*   Support aeson >= 0.11, which comes with instances for `Natural`.++*   Support GHC-8.++*   `MonadThrow`, `MonadCatch`, and `MonadMask` instances for `LoggerT`.++*   Support for Cabal-1.18 and time >= 1.4 && < 1.5.+ 0.2.3.1 ======= 
LICENSE view
@@ -1,5 +1,5 @@ Licensed under the Apache License, Version 2.0 (the "License");-you may not use this file except in compliance with the License.+you may not use this software except in compliance with the License. You may obtain a copy of the License at      http://www.apache.org/licenses/LICENSE-2.0
README.md view
@@ -21,8 +21,6 @@ Overview ======== -**This Version is yet a preview**- The logging system consists of four main parts:  1. The logging front-end are those types and functions that are used
constraints view
@@ -1,43 +1,35 @@-constraints: Cabal ==1.22.3.0,-             MonadRandom ==0.3.0.2,-             StateVar ==1.1.0.0,-             adjunctions ==4.2,-             aeson ==0.8.0.2,-             ansi-terminal ==0.6.2.1,-             ansi-wl-pprint ==0.6.7.2,+constraints: Cabal ==1.23.1.0,+             StateVar ==1.1.0.3,+             adjunctions ==4.3,+             aeson ==0.11.0.0,+             ansi-terminal ==0.6.2.3,+             ansi-wl-pprint ==0.6.7.3,              array ==0.5.1.0,-             asn1-encoding ==0.9.0,-             asn1-parse ==0.9.0,-             asn1-types ==0.3.0,-             async ==2.0.2,-             attoparsec ==0.12.1.6,-             base ==4.8.0.0,+             asn1-encoding ==0.9.3,+             asn1-parse ==0.9.4,+             asn1-types ==0.3.2,+             async ==2.1.0,+             attoparsec ==0.13.0.1,+             base ==4.8.2.0,+             base-orphans ==0.5.0,              base-unicode-symbols ==0.2.2.4,              base64-bytestring ==1.0.0.1,-             bifunctors ==4.2.1,-             binary ==0.7.4.0,+             bifunctors ==5.2,+             binary ==0.7.5.0,              blaze-builder ==0.4.0.1,              byteable ==0.1.1,              bytestring ==0.10.6.0,-             case-insensitive ==1.2.0.4,-             cereal ==0.4.1.1,-             cipher-aes ==0.2.10,-             cipher-des ==0.0.6,-             cipher-rc4 ==0.1.4,-             clock ==0.4.5.0,-             comonad ==4.2.5,-             conduit ==1.2.4,-             configuration-tools ==0.2.12,-             connection ==0.2.4,-             containers ==0.5.6.3,-             contravariant ==1.3.1,-             cookie ==0.4.1.4,-             crypto-cipher-types ==0.0.9,-             crypto-numbers ==0.2.7,-             crypto-pubkey ==0.2.8,-             crypto-pubkey-types ==0.4.3,-             crypto-random ==0.0.9,-             cryptohash ==0.11.6,+             case-insensitive ==1.2.0.6,+             cereal ==0.5.1.0,+             clock ==0.6.0.1,+             comonad ==5,+             conduit ==1.2.6.1,+             configuration-tools ==0.2.14,+             connection ==0.2.5,+             containers ==0.5.6.2,+             contravariant ==1.4,+             cookie ==0.4.1.6,+             cryptonite ==0.13,              data-default ==0.5.3,              data-default-class ==0.0.1,              data-default-instances-base ==0.0.1,@@ -46,73 +38,67 @@              data-default-instances-old-locale ==0.0.1,              deepseq ==1.4.1.1,              directory ==1.2.2.0,-             distributive ==0.4.4,-             dlist ==0.7.1.1,-             either ==4.3.3.2,+             distributive ==0.5.0.2,+             dlist ==0.7.1.2,              enclosed-exceptions ==1.0.1.1,-             errors ==1.4.7,-             exceptions ==0.8.0.2,+             exceptions ==0.8.2.1,+             fail ==4.9.0.0,              filepath ==1.4.0.0,-             free ==4.11,+             free ==4.12.4,              ghc-prim ==0.4.0.0,-             hashable ==1.2.3.2,-             hourglass ==0.2.8,-             http-client ==0.4.11.1,+             hashable ==1.2.4.0,+             hourglass ==0.2.9,+             http-client ==0.4.27,              http-client-tls ==0.2.2,-             http-types ==0.8.6,+             http-types ==0.9,              integer-gmp ==1.0.0.0,-             kan-extensions ==4.2.1,-             lens ==4.9.1,+             kan-extensions ==5.0.1,+             lens ==4.13.2.1,              lifted-base ==0.2.3.6,+             memory ==0.11,              mime-types ==0.1.0.6,-             mmorph ==1.0.4,+             mmorph ==1.0.5,              monad-control ==1.0.0.4,              mtl ==2.2.1,-             nats ==1,-             network ==2.6.0.2,-             network-uri ==2.6.0.1,+             network ==2.6.2.1,+             network-uri ==2.6.0.3,              old-locale ==1.0.0.7,-             optparse-applicative ==0.11.0.2,-             parallel ==3.2.0.6,+             optparse-applicative ==0.12.1.0,+             parallel ==3.2.1.0,              parsec ==3.1.9,              pem ==0.2.2,-             prelude-extras ==0.4,-             pretty ==1.1.3.2,-             primitive ==0.5.4.0,+             prelude-extras ==0.4.0.3,+             pretty ==1.1.2.0,+             primitive ==0.6.1.0,              process ==1.2.3.0,-             profunctors ==4.4.1,-             publicsuffixlist ==0.1,+             profunctors ==5.2,              random ==1.1,-             reflection ==1.5.1.2,-             resourcet ==1.1.4.1,+             reflection ==2.1.2,+             resourcet ==1.1.7,              rts ==1.0,-             safe ==0.3.8,-             scientific ==0.3.3.8,-             securemem ==0.1.7,-             semigroupoids ==4.3,-             semigroups ==0.16.2.2,+             scientific ==0.3.4.4,+             semigroupoids ==5.0.1,+             semigroups ==0.18.0.1,              socks ==0.5.4,-             stm ==2.4.4,-             stm-chans ==3.0.0.3,-             streaming-commons ==0.1.12,-             syb ==0.4.4,-             tagged ==0.8.0.1,+             stm ==2.4.4.1,+             stm-chans ==3.0.0.4,+             streaming-commons ==0.1.15,+             syb ==0.6,+             tagged ==0.8.2,              template-haskell ==2.10.0.0,-             text ==1.2.0.4,+             text ==1.2.2.0,              time ==1.5.0.1,-             tls ==1.2.17,-             trace ==0.2.0.0,+             tls ==1.3.4,              transformers ==0.4.2.0,              transformers-base ==0.4.4,              transformers-compat ==0.4.0.4,              unix ==2.7.1.0,-             unordered-containers ==0.2.5.1,-             utf8-string ==1,-             vector ==0.10.12.3,-             void ==0.7,-             x509 ==1.5.0.1,-             x509-store ==1.5.0,-             x509-system ==1.5.0,-             x509-validation ==1.5.1,-             yaml ==0.8.11,-             zlib ==0.6.1.0+             unordered-containers ==0.2.6.0,+             vector ==0.11.0.0,+             void ==0.7.1,+             x509 ==1.6.3,+             x509-store ==1.6.1,+             x509-system ==1.6.3,+             x509-validation ==1.6.3,+             yaml ==0.8.16,+             zlib ==0.6.1.1
src/System/Logger/Internal.hs view
@@ -1,29 +1,14 @@--- Copyright (c) 2014-2015 PivotCloud, Inc.------ System.Logger.Internal------ Please feel free to contact us at licensing@pivotmail.com with any--- contributions, additions, or other feedback; we would love to hear from--- you.------ Licensed under the Apache License, Version 2.0 (the "License"); you may--- not use this file except in compliance with the License. You may obtain a--- copy of the License at http://www.apache.org/licenses/LICENSE-2.0------ Unless required by applicable law or agreed to in writing, software--- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT--- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the--- License for the specific language governing permissions and limitations--- under the License.- -- | -- Module: System.Logger.Internal--- Copyright: Copyright (c) 2014-2015 PivotCloud, Inc.+-- Copyright:+--     Copyright (c) 2016 Lars Kuhtz <lakuhtz@gmail.com>+--     Copyright (c) 2014-2015 PivotCloud, Inc. -- License: Apache License, Version 2.0--- Maintainer: Lars Kuhtz <lkuhtz@pivotmail.com>+-- Maintainer: Lars Kuhtz <lakuhtz@gmail.com> -- Stability: experimental -- +{-# LANGUAGE CPP #-} {-# LANGUAGE UnicodeSyntax #-}  module System.Logger.Internal@@ -34,6 +19,10 @@ , timeSpecToUtc ) where +#ifndef MIN_VERSION_time+#define MIN_VERSION_time(a,b,c) 1+#endif+ import Data.Monoid.Unicode import Data.Time.Clock import Data.Time.Clock.POSIX@@ -45,6 +34,10 @@ import Prelude.Unicode  import System.Clock++#if !MIN_VERSION_time(1,5,0)+import System.Locale (defaultTimeLocale)+#endif  sshow     ∷ (Show a, IsString b)
src/System/Logger/Logger/Internal.hs view
@@ -80,13 +80,17 @@ ) where  #ifndef MIN_VERSION_base-#define MIN_VESION_base(a,b,c) 1+#define MIN_VERSION_base(a,b,c) 1 #endif  #ifndef MIN_VERSION_deepseq-#define MIN_VESION_deepseq(a,b,c) 1+#define MIN_VERSION_deepseq(a,b,c) 1 #endif +#ifndef MIN_VERSION_aeson+#define MIN_VERSION_aeson(a,b,c) 1+#endif+ import Configuration.Utils hiding (Lens', Error)  import Control.Concurrent (threadDelay)@@ -124,14 +128,14 @@ import System.Logger.Internal.Queue import System.Logger.Types +#if ! MIN_VERSION_aeson(0,11,1) && ! ( MIN_VERSION_base(4,8,0) && MIN_VERSION_aeson(0,11,0) )+ -- -------------------------------------------------------------------------- -- -- Orphans --- Submitted pull request to aeson <https://github.com/bos/aeson/pull/243> instance ToJSON Natural where     toJSON = Number ∘ fromIntegral --- Submitted pull request to aeson <https://github.com/bos/aeson/pull/243> instance FromJSON Natural where     parseJSON = withScientific "Natural" $ \n →         if n < 0@@ -139,6 +143,7 @@           else pure $ floor n           -- this seems a little odd but corresponds to all other aeson           -- instances for integral types+#endif  -- -------------------------------------------------------------------------- -- -- Logger Configuration
src/System/Logger/Types.hs view
@@ -100,13 +100,11 @@ import Control.Exception import Control.Lens hiding ((.=)) import Control.Monad.Base+import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask) import Control.Monad.Except import Control.Monad.Reader import Control.Monad.Trans.Control-import Control.Monad.Trans.Either import Control.Monad.State-import Control.Monad.Trace-import Control.Monad.Trans.Trace import Control.Monad.Writer import Control.Monad.Unicode @@ -469,28 +467,6 @@     {-# INLINE withPolicy #-}     {-# INLINE localScope #-} -instance (MonadLog a m) ⇒ MonadLog a (TraceT t e m) where-    logg l = lift ∘ logg l-    withLevel level inner = liftWith (\run → withLevel level (run inner)) ≫= restoreT ∘ return-    withPolicy policy inner = liftWith (\run → withPolicy policy (run inner)) ≫= restoreT ∘ return-    localScope f inner = liftWith (\run → localScope f (run inner)) ≫= restoreT ∘ return--    {-# INLINE logg #-}-    {-# INLINE withLevel #-}-    {-# INLINE withPolicy #-}-    {-# INLINE localScope #-}--instance (MonadLog a m) ⇒ MonadLog a (EitherT σ m) where-    logg l = lift ∘ logg l-    withLevel level inner = liftWith (\run → withLevel level (run inner)) ≫= restoreT ∘ return-    withPolicy policy inner = liftWith (\run → withPolicy policy (run inner)) ≫= restoreT ∘ return-    localScope f inner = liftWith (\run → localScope f (run inner)) ≫= restoreT ∘ return--    {-# INLINE logg #-}-    {-# INLINE withLevel #-}-    {-# INLINE withPolicy #-}-    {-# INLINE localScope #-}- {- -- Uses @OverlappingInstances@ to lift MonadLog in all transformers with an -- instance for 'MonadTransControl'.@@ -548,23 +524,28 @@     {-# INLINE withLoggerPolicy #-}  newtype LoggerCtxT ctx m α = LoggerCtxT { unLoggerCtxT ∷ ReaderT ctx m α }-    deriving (Functor, Applicative, Monad, MonadIO, MonadTrans, MonadReader ctx, MonadError a, MonadState a, MonadWriter a, MonadBase a, MonadTrace t)+    deriving (Functor, Applicative, Monad, MonadIO, MonadTrans, MonadReader ctx, MonadError a, MonadState a, MonadWriter a, MonadBase a, MonadThrow, MonadCatch, MonadMask)  instance MonadTransControl (LoggerCtxT ctx) where     type StT (LoggerCtxT ctx) a = StT (ReaderT ctx) a     liftWith = defaultLiftWith LoggerCtxT unLoggerCtxT     restoreT = defaultRestoreT LoggerCtxT+    {-# INLINE liftWith #-}+    {-# INLINE restoreT #-}  instance MonadBaseControl b m ⇒ MonadBaseControl b (LoggerCtxT ctx m) where     type StM (LoggerCtxT ctx m) a = ComposeSt (LoggerCtxT ctx) m a     liftBaseWith = defaultLiftBaseWith     restoreM = defaultRestoreM+    {-# INLINE liftBaseWith #-}+    {-# INLINE restoreM #-}  runLoggerCtxT     ∷ LoggerCtxT ctx m α     → ctx     → m α runLoggerCtxT = runReaderT ∘ unLoggerCtxT+{-# INLINE runLoggerCtxT #-}  instance (Show a, Typeable a, NFData a, MonadIO m, LoggerCtx ctx a) ⇒ MonadLog a (LoggerCtxT ctx m) where     logg l m = ask ≫= \ctx → liftIO (loggerFunIO ctx l m)
test/TastyTools.hs view
@@ -120,7 +120,8 @@     → (ProgressFunction → Assertion)         -- ^ test method     → TestTree-testCaseProgress testName = singleTest (T.unpack testName) ∘ TestCaseProgress+testCaseProgress testName test =+    singleTest (T.unpack testName) $ TestCaseProgress test  -- -------------------------------------------------------------------------- -- -- Step@@ -141,6 +142,6 @@     → (StepFunction → Assertion)         -- ^ test method     → TestTree-testCaseSteps testName inner = singleTest (T.unpack testName) ∘ TestCaseProgress $ \f →-    inner (f 0)+testCaseSteps testName inner = singleTest (T.unpack testName) $+    TestCaseProgress $ \f → inner (f 0) 
yet-another-logger.cabal view
@@ -1,5 +1,5 @@ Name: yet-another-logger-Version: 0.2.3.1+Version: 0.3.0 Synopsis: Yet Another Logger Description:     A logging framework written with flexibility and performance@@ -50,9 +50,11 @@  Homepage: https://github.com/alephcloud/hs-yet-another-logger License: Apache-2.0-Author: Lars Kuhtz <lkuhtz@pivotmail.com>-Maintainer: Lars Kuhtz <lkuhtz@pivotmail.com>-Copyright: Copyright (c) 2014-2015 PivotCloud, Inc.+Author: Lars Kuhtz <lakuhtz@gmail.com>+Maintainer: Lars Kuhtz <lakuhtz@gmail.com>+Copyright:+    Copyright (c) 2016 Lars Kuhtz <lakuhtz@gmail.com>+    Copyright (c) 2014-2015 PivotCloud, Inc. Category: Logging, System Build-type: Simple Cabal-version: >= 1.18@@ -73,8 +75,12 @@     type: git     location: https://github.com/alephcloud/hs-yet-another-logger     branch: master-    tag: 0.2.3.1+    tag: 0.3.0 +flag old-time+    manual: False+    default: False+ Library     default-language: Haskell2010     hs-source-dirs: src@@ -100,8 +106,8 @@         clock >= 0.4,         configuration-tools >= 0.2.8,         deepseq >= 1.3,-        either >= 4.3,         enclosed-exceptions >= 1.0,+        exceptions >= 0.8,         lens >= 4.6,         lifted-base >= 0.2.3,         monad-control >= 1.0,@@ -110,8 +116,7 @@         stm >= 2.4,         stm-chans >= 3.0,         text >= 1.2,-        time >= 1.5,-        trace >= 0.2,+        time >= 1.4,         transformers >= 0.3,         transformers-base >= 0.4,         void >= 0.7@@ -120,6 +125,14 @@         build-depends:             nats >= 1 +    if flag(old-time)+        build-depends:+            old-locale >= 1.0,+            time >= 1.4 && < 1.5+    else+        build-depends:+            time >= 1.5+     ghc-options: -Wall  test-suite tests@@ -153,7 +166,7 @@         build-depends:             nats >= 1 -    ghc-options: -Wall -threaded -with-rtsopts=-N+    ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N  Executable example     default-language: Haskell2010