yet-another-logger 0.3.0 → 0.3.1
raw patch · 11 files changed
+64/−248 lines, 11 filesdep −old-localedep ~aesondep ~basedep ~deepseqPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: old-locale
Dependency ranges changed: aeson, base, deepseq, time
API changes (from Hackage documentation)
- System.Logger.Internal.Queue: data TBMChan a :: * -> *
+ System.Logger.Internal.Queue: data TBMChan a
- System.Logger.Internal.Queue: data TBMQueue a :: * -> *
+ System.Logger.Internal.Queue: data TBMQueue a
- System.Logger.Types: class LoggerCtx ctx msg | ctx -> msg where withLoggerLevel level ctx f = f $ ctx & setLoggerLevel .~ level withLoggerLabel label ctx f = f $ ctx & setLoggerScope %~ (:) label withLoggerPolicy policy ctx f = f $ ctx & setLoggerPolicy .~ policy
+ System.Logger.Types: class LoggerCtx ctx msg | ctx -> msg
Files
- CHANGELOG.md +16/−1
- constraints +0/−104
- src/System/Logger/Backend/ColorOption.hs +5/−10
- src/System/Logger/Backend/Handle.hs +5/−12
- src/System/Logger/Internal.hs +1/−9
- src/System/Logger/Internal/Queue.hs +5/−10
- src/System/Logger/Logger/Internal.hs +5/−42
- src/System/Logger/Types.hs +5/−15
- test/NoBackend.hs +4/−4
- test/TastyTools.hs +8/−12
- yet-another-logger.cabal +10/−29
CHANGELOG.md view
@@ -1,9 +1,24 @@+0.3.1+=====++* Add support for tasty-hunit >= 0.10.++* Raise lower bounds on some dependencies:+ * base >= 4.8+ * deepseq >= 1.4+ * aeson >= 0.11+ * time >= 1.5++* Require Cabal >= 1.22.++* Drop support for GHC < 7.10.+ 0.3.0 ===== * Remove `EitherT` instance. It's recommended to use `ExceptT` instead. -* Remove `TraceT` instace. It's not actively maintained any more.+* Remove `TraceT` instance. It's not actively maintained any more. * Support aeson >= 0.11, which comes with instances for `Natural`.
− constraints
@@ -1,104 +0,0 @@-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.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 ==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.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,- data-default-instances-containers ==0.0.1,- data-default-instances-dlist ==0.0.1,- data-default-instances-old-locale ==0.0.1,- deepseq ==1.4.1.1,- directory ==1.2.2.0,- distributive ==0.5.0.2,- dlist ==0.7.1.2,- enclosed-exceptions ==1.0.1.1,- exceptions ==0.8.2.1,- fail ==4.9.0.0,- filepath ==1.4.0.0,- free ==4.12.4,- ghc-prim ==0.4.0.0,- hashable ==1.2.4.0,- hourglass ==0.2.9,- http-client ==0.4.27,- http-client-tls ==0.2.2,- http-types ==0.9,- integer-gmp ==1.0.0.0,- 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.5,- monad-control ==1.0.0.4,- mtl ==2.2.1,- network ==2.6.2.1,- network-uri ==2.6.0.3,- old-locale ==1.0.0.7,- optparse-applicative ==0.12.1.0,- parallel ==3.2.1.0,- parsec ==3.1.9,- pem ==0.2.2,- prelude-extras ==0.4.0.3,- pretty ==1.1.2.0,- primitive ==0.6.1.0,- process ==1.2.3.0,- profunctors ==5.2,- random ==1.1,- reflection ==2.1.2,- resourcet ==1.1.7,- rts ==1.0,- scientific ==0.3.4.4,- semigroupoids ==5.0.1,- semigroups ==0.18.0.1,- socks ==0.5.4,- 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.2.0,- time ==1.5.0.1,- 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.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/Backend/ColorOption.hs view
@@ -1,3 +1,4 @@+-- Copyright (c) 2016-2018 Lars Kuhtz <lakuhtz@gmail.com> -- Copyright (c) 2014-2015 PivotCloud, Inc. -- -- System.Logger.Backend.ColorOption@@ -18,9 +19,11 @@ -- | -- Module: System.Logger.Backend.ColorOption--- Copyright: Copyright (c) 2014-2015 PivotCloud, Inc.+-- Copyright:+-- Copyright (c) 2016-2018 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 -- -- An option that indicates whether ANSI color escapes shall@@ -29,7 +32,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UnicodeSyntax #-}@@ -44,19 +46,12 @@ , useColor ) where -#ifndef MIN_VERSION_base-#define MIN_VERSION_base(x,y,z) 1-#endif- import Configuration.Utils import Control.DeepSeq import Control.Monad.Except import qualified Data.CaseInsensitive as CI-#if ! MIN_VERSION_base(4,8,0)-import Data.Monoid-#endif import Data.Monoid.Unicode import Data.String import qualified Data.Text as T
src/System/Logger/Backend/Handle.hs view
@@ -1,3 +1,4 @@+-- Copyright (c) 2016-2018 Lars Kuhtz <lakuhtz@gmail.com> -- Copyright (c) 2014-2015 PivotCloud, Inc. -- -- System.Logger.Backend.Handle@@ -19,9 +20,11 @@ -- | -- Module: System.Logger.Backend.Handle -- Description: Handle Backend for Yet Another Logger--- Copyright: Copyright (c) 2014-2015 PivotCloud, Inc.+-- Copyright:+-- Copyright (c) 2016-2018 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 -- @@ -31,7 +34,6 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE RecordWildCards #-}-{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UnicodeSyntax #-}@@ -62,10 +64,6 @@ , handleBackend_ ) where -#ifndef MIN_VERSION_deepseq-#define MIN_VESION_deepseq(a,b,c) 1-#endif- import Configuration.Utils hiding (Lens', Error) import Configuration.Utils.Validation @@ -176,12 +174,7 @@ handleBackendConfigHandle ∷ Lens' HandleBackendConfig LoggerHandleConfig handleBackendConfigHandle = lens _handleBackendConfigHandle $ \a b → a { _handleBackendConfigHandle = b } -#if MIN_VERSION_deepseq(1,4,0) instance NFData HandleBackendConfig-#else-instance NFData HandleBackendConfig where- rnf (HandleBackendConfig a0 a1) = rnf a0 `seq` rnf a1-#endif defaultHandleBackendConfig ∷ HandleBackendConfig defaultHandleBackendConfig = HandleBackendConfig
src/System/Logger/Internal.hs view
@@ -1,7 +1,7 @@ -- | -- Module: System.Logger.Internal -- Copyright:--- Copyright (c) 2016 Lars Kuhtz <lakuhtz@gmail.com>+-- Copyright (c) 2016-2018 Lars Kuhtz <lakuhtz@gmail.com> -- Copyright (c) 2014-2015 PivotCloud, Inc. -- License: Apache License, Version 2.0 -- Maintainer: Lars Kuhtz <lakuhtz@gmail.com>@@ -19,10 +19,6 @@ , 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@@ -34,10 +30,6 @@ 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/Internal/Queue.hs view
@@ -1,3 +1,4 @@+-- Copyright (c) 2016-2018 Lars Kuhtz <lakuhtz@gmail.com> -- Copyright (c) 2014-2015 PivotCloud, Inc. -- -- System.Logger@@ -19,9 +20,11 @@ -- | -- Module: System.Logger.Internal.Queue -- Description: Queues for Usage with Yet Another Logger--- Copyright: Copyright © 2015 PivotCloud, Inc.+-- Copyright:+-- Copyright © 2016-2018 Lars Kuhtz <lakuhtz@gmail.com>+-- Copyright © 2015 PivotCloud, Inc. -- License: Apache-2.0--- Maintainer: Lars Kuhtz <lkuhtz@pivotmail.com>+-- Maintainer: Lars Kuhtz <lakuhtz@gmail.com> -- Stability: experimental -- @@ -31,7 +34,6 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE LambdaCase #-}-{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UnicodeSyntax #-} @@ -42,13 +44,6 @@ , TBMChan ) where -#ifndef MIN_VERSION_base-#define MIN_VERSION_base(x,y,z) = 1-#endif--#if ! MIN_VERSION_base(4,8,0)-import Control.Applicative-#endif import Control.Concurrent import Control.Concurrent.STM import Control.Concurrent.STM.TBMChan
src/System/Logger/Logger/Internal.hs view
@@ -1,3 +1,4 @@+-- Copyright (c) 2016-2018 Lars Kuhtz <lakuhtz@gmail.com> -- Copyright (c) 2014-2015 PivotCloud, Inc. -- -- System.Logger.Logger.Internal@@ -19,9 +20,11 @@ -- | -- Module: System.Logger.Logger.Internal -- Description: Yet Another Logger Implementation--- Copyright: Copyright (c) 2014-2015 PivotCloud, Inc.+-- Copyright:+-- Copyright (c) 2016-2018 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 -- -- This module provides a logger that implements the logger interface@@ -79,18 +82,6 @@ , runLogT ) where -#ifndef MIN_VERSION_base-#define MIN_VERSION_base(a,b,c) 1-#endif--#ifndef MIN_VERSION_deepseq-#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)@@ -128,24 +119,7 @@ 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--instance ToJSON Natural where- toJSON = Number ∘ fromIntegral--instance FromJSON Natural where- parseJSON = withScientific "Natural" $ \n →- if n < 0- then fail $ "expected a natural number but got " ⊕ show n- else pure $ floor n- -- this seems a little odd but corresponds to all other aeson- -- instances for integral types-#endif---- -------------------------------------------------------------------------- -- -- Logger Configuration -- | Logger Configuration@@ -203,18 +177,7 @@ loggerConfigExitTimeout ∷ Lens' LoggerConfig (Maybe Natural) loggerConfigExitTimeout = lens _loggerConfigExitTimeout $ \a b → a { _loggerConfigExitTimeout = b } -#if ! MIN_VERSION_deepseq(1,4,0) || ! MIN_VERSION_base(4,8,0)-instance NFData Natural where- rnf a = a `seq` ()-#endif--#if MIN_VERSION_deepseq(1,4,0) instance NFData LoggerConfig-#else-instance NFData LoggerConfig where- rnf (LoggerConfig a0 a1 a2 a3 a4 a5 a6) =- rnf a0 `seq` rnf a1 `seq` rnf a2 `seq` rnf a3 `seq` rnf a4 `seq` rnf a5 `seq` rnf a6-#endif -- | Default Logger configuration --
src/System/Logger/Types.hs view
@@ -1,3 +1,4 @@+-- Copyright (c) 2016-2018 Lars Kuhtz <lakuhtz@gmail.com> -- Copyright (c) 2014-2015 PivotCloud, Inc. -- -- System.Logger.Types@@ -19,9 +20,11 @@ -- | -- Module: System.Logger.Types -- Description: Basic Types of Yet Another Logger--- Copyright: Copyright (c) 2014-2015 PivotCloud, Inc.+-- Copyright:+-- Copyright (c) 2016-2018 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 -- @@ -37,7 +40,6 @@ {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE UnicodeSyntax #-}@@ -90,10 +92,6 @@ ) where -#ifndef MIN_VERSION_deepseq-#define MIN_VESION_deepseq(a,b,c) 1-#endif- import Configuration.Utils hiding (Lens, Lens', Error) import Control.DeepSeq@@ -315,16 +313,8 @@ logMsgTime ∷ Lens' (LogMessage a) TimeSpec logMsgTime = lens _logMsgTime $ \a b → a { _logMsgTime = b } -#if MIN_VERSION_deepseq(1,4,0) instance NFData TimeSpec instance NFData a ⇒ NFData (LogMessage a)-#else-instance NFData TimeSpec where- rnf (TimeSpec a0 a1) = rnf a0 `seq` rnf a1-instance NFData a ⇒ NFData (LogMessage a) where- rnf (LogMessage a0 a1 a2 a3) =- rnf a0 `seq` rnf a1 `seq` rnf a2 `seq` rnf a3-#endif -- | This is given to logger when it is created. It formats and delivers -- individual log messages synchronously. The backend is called once for each
test/NoBackend.hs view
@@ -128,7 +128,7 @@ tc args = testCaseSteps (sshow args) $ \logLogStr → catchAny (noBackendLoggerTest logLogStr args)- (\e → assertString $ "unexpected exception: " ⊕ show e)+ (\e → assertFailure $ "unexpected exception: " ⊕ show e) -- Buggy Backend that calls 'BackendTerminatedException'. --@@ -139,7 +139,7 @@ tc args = testCaseSteps (sshow args) $ \logLogStr → do buggyBackendLoggerTest exception (\x → x `mod` m <= n) logLogStr args- assertString $ "Missing expected exception"+ assertFailure "Missing expected exception" `catch` \(e ∷ LoggerException Void) → case e of BackendTerminatedException e0 → case fromException e0 of Just BuggyBackendException → logLogStr $ "test: expected exception: " ⊕ sshow e@@ -159,7 +159,7 @@ do buggyBackendLoggerTest exception (\x → x `mod` n <= m) logLogStr args `catchAny` \e →- assertString $ "test: unexpected exception: " ⊕ show e+ assertFailure $ "test: unexpected exception: " ⊕ show e exception = BuggyBackendException -- | Buggy Backend that calls some exception.@@ -176,7 +176,7 @@ -- Make sure to configure the exitWait and exceptionWait so that -- the backend has enough time to deliver enough messages to trigger -- and exception.- assertString $ "Missing expected exception: " ⊕ sshow exception+ assertFailure $ "Missing expected exception: " ⊕ sshow exception `catch` \(e ∷ LoggerException Void) → case e of BackendTooManyExceptions (e0:_) → case fromException e0 of Just BuggyBackendException → logLogStr $ "test: expected exception: " ⊕ sshow e
test/TastyTools.hs view
@@ -1,3 +1,4 @@+-- Copyright (c) 2016-2018 Lars Kuhtz <lakuhtz@gmail.com> -- Copyright (c) 2013-2015 PivotCloud, Inc. All Rights Reserved. -- -- NOTICE: The dissemination, reproduction, or copying of this file and the@@ -8,9 +9,11 @@ -- | -- Module: TastyTools--- Copyright: Copyright (c) 2013-2015 PivotCloud, Inc. All Rights Reserved.+-- Copyright:+-- Copyright (c) 2016-2018 Lars Kuhtz <lakuhtz@gmail.com>+-- Copyright (c) 2013-2015 PivotCloud, Inc. All Rights Reserved. -- License: All Rights Reserved, see LICENSE file of the package--- Maintainer: code@pivotmail.com+-- Maintainer: Lars Kuhtz <lakuhtz@gmail> -- Stability: experimental -- @@ -32,15 +35,8 @@ , testCaseSteps ) where -#ifndef MIN_VERSION_base-#define MIN_VESION_base(x,y,z) 1-#endif- import Configuration.Utils (boolReader) -#if ! MIN_VERSION_base(4,8,0)-import Control.Applicative-#endif import Control.Exception (try) import Control.Monad import Control.Monad.IO.Class@@ -88,13 +84,13 @@ run opts (TestCaseProgress testAssertion) prog = do outRef ← newIORef "" try (testAssertion $ step outRef) >>= \case- Left (HUnitFailure errMsg) → if verbose+ Left e@HUnitFailure{} → if verbose then do output ← readIORef outRef return ∘ testFailed ∘ LT.unpack ∘ LT.toLazyText $- output ⊕ "\n" ⊕ LT.fromString errMsg+ output ⊕ "\n" ⊕ LT.fromString (show e) else- return ∘ testFailed $ errMsg+ return ∘ testFailed $ show e Right () → if verbose then testPassed ∘ LT.unpack ∘ LT.toLazyText <$> readIORef outRef
yet-another-logger.cabal view
@@ -1,5 +1,6 @@+Cabal-version: 1.22 Name: yet-another-logger-Version: 0.3.0+Version: 0.3.1 Synopsis: Yet Another Logger Description: A logging framework written with flexibility and performance@@ -53,20 +54,16 @@ Author: Lars Kuhtz <lakuhtz@gmail.com> Maintainer: Lars Kuhtz <lakuhtz@gmail.com> Copyright:- Copyright (c) 2016 Lars Kuhtz <lakuhtz@gmail.com>+ Copyright (c) 2016-2018 Lars Kuhtz <lakuhtz@gmail.com> Copyright (c) 2014-2015 PivotCloud, Inc. Category: Logging, System Build-type: Simple-Cabal-version: >= 1.18 License-file: LICENSE extra-doc-files: README.md, CHANGELOG.md -extra-source-files:- constraints- source-repository head type: git location: https://github.com/alephcloud/hs-yet-another-logger@@ -75,11 +72,7 @@ type: git location: https://github.com/alephcloud/hs-yet-another-logger branch: master- tag: 0.3.0--flag old-time- manual: False- default: False+ tag: 0.3.1 Library default-language: Haskell2010@@ -97,15 +90,15 @@ build-depends: async >= 2.0,- aeson >= 0.7,+ aeson >= 0.11, ansi-terminal >= 0.6,- base == 4.*,+ base >= 4.8 && < 5.0, base-unicode-symbols >= 0.2, bytestring >= 0.10, case-insensitive >= 1.2, clock >= 0.4, configuration-tools >= 0.2.8,- deepseq >= 1.3,+ deepseq >= 1.4, enclosed-exceptions >= 1.0, exceptions >= 0.8, lens >= 4.6,@@ -116,23 +109,11 @@ stm >= 2.4, stm-chans >= 3.0, text >= 1.2,- time >= 1.4,+ time >= 1.5, transformers >= 0.3, transformers-base >= 0.4, void >= 0.7 - if !impl(ghc>=7.9)- 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@@ -147,7 +128,7 @@ build-depends: async >= 2.0,- base == 4.*,+ base >= 4.8 && < 5.0, base-unicode-symbols >= 0.2, configuration-tools >= 0.2.12, enclosed-exceptions >= 1.0,@@ -174,6 +155,6 @@ main-is: Example.hs build-depends:- base == 4.*,+ base >= 4.8 && < 5.0, Cabal >= 1.18, yet-another-logger