packages feed

katip 0.6.3.0 → 0.7.0.0

raw patch · 6 files changed

+36/−11 lines, 6 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Katip: logLocM :: (Applicative m, KatipContext m, HasCallStack) => Severity -> LogStr -> m ()
- Katip: Scribe :: forall a. LogItem a => Item a -> IO () -> IO () -> Scribe
+ Katip: Scribe :: (forall a. LogItem a => Item a -> IO ()) -> IO () -> Scribe
- Katip: itemApp :: forall a_ae56. Lens' (Item a_ae56) Namespace
+ Katip: itemApp :: forall a_aeDe. Lens' (Item a_aeDe) Namespace
- Katip: itemEnv :: forall a_ae56. Lens' (Item a_ae56) Environment
+ Katip: itemEnv :: forall a_aeDe. Lens' (Item a_aeDe) Environment
- Katip: itemHost :: forall a_ae56. Lens' (Item a_ae56) HostName
+ Katip: itemHost :: forall a_aeDe. Lens' (Item a_aeDe) HostName
- Katip: itemLoc :: forall a_ae56. Lens' (Item a_ae56) (Maybe Loc)
+ Katip: itemLoc :: forall a_aeDe. Lens' (Item a_aeDe) (Maybe Loc)
- Katip: itemMessage :: forall a_ae56. Lens' (Item a_ae56) LogStr
+ Katip: itemMessage :: forall a_aeDe. Lens' (Item a_aeDe) LogStr
- Katip: itemNamespace :: forall a_ae56. Lens' (Item a_ae56) Namespace
+ Katip: itemNamespace :: forall a_aeDe. Lens' (Item a_aeDe) Namespace
- Katip: itemPayload :: forall a_ae56 a_ak8O. Lens (Item a_ae56) (Item a_ak8O) a_ae56 a_ak8O
+ Katip: itemPayload :: forall a_aeDe a_akYR. Lens (Item a_aeDe) (Item a_akYR) a_aeDe a_akYR
- Katip: itemProcess :: forall a_ae56. Lens' (Item a_ae56) ProcessID
+ Katip: itemProcess :: forall a_aeDe. Lens' (Item a_aeDe) ProcessID
- Katip: itemSeverity :: forall a_ae56. Lens' (Item a_ae56) Severity
+ Katip: itemSeverity :: forall a_aeDe. Lens' (Item a_aeDe) Severity
- Katip: itemThread :: forall a_ae56. Lens' (Item a_ae56) ThreadIdText
+ Katip: itemThread :: forall a_aeDe. Lens' (Item a_aeDe) ThreadIdText
- Katip: itemTime :: forall a_ae56. Lens' (Item a_ae56) UTCTime
+ Katip: itemTime :: forall a_aeDe. Lens' (Item a_aeDe) UTCTime
- Katip: katipAddNamespace :: (KatipContext m) => Namespace -> m a -> m a
+ Katip: katipAddNamespace :: KatipContext m => Namespace -> m a -> m a
- Katip: katipNoLogging :: (Katip m) => m a -> m a
+ Katip: katipNoLogging :: Katip m => m a -> m a
- Katip: liftPayload :: (LogItem a) => a -> LogContexts
+ Katip: liftPayload :: LogItem a => a -> LogContexts
- Katip: logItemM :: (Applicative m, KatipContext m) => Maybe Loc -> Severity -> LogStr -> m ()
+ Katip: logItemM :: (Applicative m, KatipContext m, HasCallStack) => Maybe Loc -> Severity -> LogStr -> m ()
- Katip: runKatipContextT :: (LogItem c) => LogEnv -> c -> Namespace -> KatipContextT m a -> m a
+ Katip: runKatipContextT :: LogItem c => LogEnv -> c -> Namespace -> KatipContextT m a -> m a
- Katip.Core: Scribe :: forall a. LogItem a => Item a -> IO () -> IO () -> Scribe
+ Katip.Core: Scribe :: (forall a. LogItem a => Item a -> IO ()) -> IO () -> Scribe
- Katip.Core: getLoc :: (?loc :: CallStack) => Maybe Loc
+ Katip.Core: getLoc :: HasCallStack => Maybe Loc
- Katip.Core: itemApp :: forall a_ae56. Lens' (Item a_ae56) Namespace
+ Katip.Core: itemApp :: forall a_aeDe. Lens' (Item a_aeDe) Namespace
- Katip.Core: itemEnv :: forall a_ae56. Lens' (Item a_ae56) Environment
+ Katip.Core: itemEnv :: forall a_aeDe. Lens' (Item a_aeDe) Environment
- Katip.Core: itemHost :: forall a_ae56. Lens' (Item a_ae56) HostName
+ Katip.Core: itemHost :: forall a_aeDe. Lens' (Item a_aeDe) HostName
- Katip.Core: itemLoc :: forall a_ae56. Lens' (Item a_ae56) (Maybe Loc)
+ Katip.Core: itemLoc :: forall a_aeDe. Lens' (Item a_aeDe) (Maybe Loc)
- Katip.Core: itemMessage :: forall a_ae56. Lens' (Item a_ae56) LogStr
+ Katip.Core: itemMessage :: forall a_aeDe. Lens' (Item a_aeDe) LogStr
- Katip.Core: itemNamespace :: forall a_ae56. Lens' (Item a_ae56) Namespace
+ Katip.Core: itemNamespace :: forall a_aeDe. Lens' (Item a_aeDe) Namespace
- Katip.Core: itemPayload :: forall a_ae56 a_ak8O. Lens (Item a_ae56) (Item a_ak8O) a_ae56 a_ak8O
+ Katip.Core: itemPayload :: forall a_aeDe a_akYR. Lens (Item a_aeDe) (Item a_akYR) a_aeDe a_akYR
- Katip.Core: itemProcess :: forall a_ae56. Lens' (Item a_ae56) ProcessID
+ Katip.Core: itemProcess :: forall a_aeDe. Lens' (Item a_aeDe) ProcessID
- Katip.Core: itemSeverity :: forall a_ae56. Lens' (Item a_ae56) Severity
+ Katip.Core: itemSeverity :: forall a_aeDe. Lens' (Item a_aeDe) Severity
- Katip.Core: itemThread :: forall a_ae56. Lens' (Item a_ae56) ThreadIdText
+ Katip.Core: itemThread :: forall a_aeDe. Lens' (Item a_aeDe) ThreadIdText
- Katip.Core: itemTime :: forall a_ae56. Lens' (Item a_ae56) UTCTime
+ Katip.Core: itemTime :: forall a_aeDe. Lens' (Item a_aeDe) UTCTime
- Katip.Core: katipNoLogging :: (Katip m) => m a -> m a
+ Katip.Core: katipNoLogging :: Katip m => m a -> m a
- Katip.Core: logLoc :: (Applicative m, LogItem a, Katip m, ?loc :: CallStack) => a -> Namespace -> Severity -> LogStr -> m ()
+ Katip.Core: logLoc :: (Applicative m, LogItem a, Katip m, HasCallStack) => a -> Namespace -> Severity -> LogStr -> m ()
- Katip.Monadic: katipAddNamespace :: (KatipContext m) => Namespace -> m a -> m a
+ Katip.Monadic: katipAddNamespace :: KatipContext m => Namespace -> m a -> m a
- Katip.Monadic: liftPayload :: (LogItem a) => a -> LogContexts
+ Katip.Monadic: liftPayload :: LogItem a => a -> LogContexts
- Katip.Monadic: logItemM :: (Applicative m, KatipContext m) => Maybe Loc -> Severity -> LogStr -> m ()
+ Katip.Monadic: logItemM :: (Applicative m, KatipContext m, HasCallStack) => Maybe Loc -> Severity -> LogStr -> m ()
- Katip.Monadic: logLocM :: (Applicative m, KatipContext m) => Severity -> LogStr -> m ()
+ Katip.Monadic: logLocM :: (Applicative m, KatipContext m, HasCallStack) => Severity -> LogStr -> m ()
- Katip.Monadic: runKatipContextT :: (LogItem c) => LogEnv -> c -> Namespace -> KatipContextT m a -> m a
+ Katip.Monadic: runKatipContextT :: LogItem c => LogEnv -> c -> Namespace -> KatipContextT m a -> m a

Files

changelog.md view
@@ -1,3 +1,8 @@+0.7.0.0+=======+* Exclusively use HasCallstack for location reporting in errors. Credit to [Domen Kožar](https://github.com/domenkozar)+* Drop support for GHC 7.x+ 0.6.3.0 ======= * Add `ToJSON`/`FromJSON` instances for Verbosity. Credit to [Aleksey Khudyakov](https://github.com/Shimuuar).
katip.cabal view
@@ -1,5 +1,5 @@ name:                katip-version:             0.6.3.0+version:             0.7.0.0 synopsis:            A structured logging framework. description:   Katip is a structured logging framework. See README.md for more details.@@ -25,7 +25,7 @@   test/Katip/Tests/Scribes/Handle.hs   test/Katip/Tests/Scribes/Handle-text.golden   test/Katip/Tests/Format/Time.hs-tested-with: GHC == 7.8.4, GHC== 7.10.3+tested-with: GHC == 8.0.1, GHC == 8.2.2, GHC == 8.4.3  source-repository head   type:     git
src/Katip.hs view
@@ -166,6 +166,7 @@     , KatipContext (..)     , logFM     , logTM+    , logLocM     , logItemM     , logExceptionM     , AnyLogContext
src/Katip/Core.hs view
@@ -7,7 +7,6 @@ {-# LANGUAGE FlexibleInstances          #-} {-# LANGUAGE GADTs                      #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE ImplicitParams             #-} {-# LANGUAGE MultiParamTypeClasses      #-} {-# LANGUAGE OverloadedStrings          #-} {-# LANGUAGE RankNTypes                 #-}@@ -997,11 +996,15 @@ -- fill the 'Maybe Loc' gap in 'logF' of this module, and relies on implicit -- callstacks when available (GHC > 7.8). #if MIN_VERSION_base(4, 8, 0)-getLoc :: (?loc :: CallStack) => Maybe Loc-getLoc = case getCallStack ?loc of+getLoc :: HasCallStack => Maybe Loc+getLoc = case getCallStack callStack of   [] -> Nothing-  xs -> Just . toLoc . last $ xs+  xs -> Just . toLoc . head $ filter filterKatip xs   where+    filterKatip :: (String, SrcLoc) -> Bool+    filterKatip (_, srcloc) = not $+      "katip-" `isPrefixOf` srcLocPackage srcloc+     toLoc :: (String, SrcLoc) -> Loc     toLoc (_, l) = Loc {         loc_filename = srcLocFile l@@ -1032,7 +1035,7 @@   ---------------------------------------------------------------------------------- | 'Loc'-tagged logging using implicit-callstacks when available.+-- | 'Loc'-tagged logging using 'GHC.Stack' when available. -- -- This function does not require template-haskell as it -- automatically uses <https://hackage.haskell.org/package/base-4.8.2.0/docs/GHC-Stack.html#v:getCallStack implicit-callstacks>@@ -1043,7 +1046,7 @@ -- -- @logLoc obj mempty InfoS "Hello world"@ #if MIN_VERSION_base(4, 8, 0)-logLoc :: (Applicative m, LogItem a, Katip m, ?loc :: CallStack)+logLoc :: (Applicative m, LogItem a, Katip m, HasCallStack) #else logLoc :: (Applicative m, LogItem a, Katip m) #endif
src/Katip/Monadic.hs view
@@ -68,6 +68,12 @@ import           Data.Semigroup                    as Semi import           Data.Sequence                     as Seq import           Data.Text                         (Text)+#if MIN_VERSION_base(4, 8, 0)+#if !MIN_VERSION_base(4, 9, 0)+import           GHC.SrcLoc+#endif+import           GHC.Stack+#endif import           Language.Haskell.TH ------------------------------------------------------------------------------- import           Katip.Core@@ -235,7 +241,7 @@ -- very low level and you typically can use 'logTM' in its -- place. Automatically supplies payload and namespace. logItemM-    :: (Applicative m, KatipContext m)+    :: (Applicative m, KatipContext m, HasCallStack)     => Maybe Loc     -> Severity     -> LogStr@@ -272,18 +278,21 @@   ---------------------------------------------------------------------------------- | 'Loc'-tagged logging when using <https://hackage.haskell.org/package/base-4.8.2.0/docs/GHC-Stack.html#v:getCallStack implicit-callstacks>.+-- | 'Loc'-tagged logging when using 'GHC.Stack.getCallStack' implicit-callstacks>. --   Automatically supplies payload and namespace. -- -- Same consideration as `logLoc` applies. --+-- Location will be logged from the module that invokes 'logLocM' so+-- be aware that wrapping 'logLocM' will make location reporting useless.+-- -- This function does not require template-haskell. Using GHC <= 7.8 will result -- in the emission of a log line without any location information. -- Users using GHC <= 7.8 may want to use the template-haskell function -- `logTM` for maximum compatibility. -- -- @logLocM InfoS "Hello world"@-logLocM :: (Applicative m, KatipContext m)+logLocM :: (Applicative m, KatipContext m, HasCallStack)         => Severity         -> LogStr         -> m ()
test/Katip/Tests.hs view
@@ -126,6 +126,13 @@         , (baseNS <> "added" <> "namespace", baseCtx, "with namespaces")         , (baseNS <> "added", HM.insert "additional" (Bool True) baseCtx, "additional context")         ]+  , testCase "Katip.Monadic.logLocM" $ do+      (le, items) <- recordingEnv+      runKatipContextT le (sl "base_context" (42 :: Int)) "base_namespace" $ logLocM InfoS "basic log"+      _ <- closeScribes le+      loggedItems <- readTVarIO items+      let loc = _itemLoc (head loggedItems)+      fmap loc_module loc @?= Just "Katip.Tests"   ]   where     recordingEnv :: IO (LogEnv, TVar [Item Object])