katip 0.8.7.0 → 0.8.7.1
raw patch · 6 files changed
+63/−12 lines, 6 filesdep ~aesondep ~asyncdep ~textPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: aeson, async, text
API changes (from Hackage documentation)
- Katip: itemApp :: forall a_acfP. Lens' (Item a_acfP) Namespace
+ Katip: itemApp :: forall a_a9QL. Lens' (Item a_a9QL) Namespace
- Katip: itemEnv :: forall a_acfP. Lens' (Item a_acfP) Environment
+ Katip: itemEnv :: forall a_a9QL. Lens' (Item a_a9QL) Environment
- Katip: itemHost :: forall a_acfP. Lens' (Item a_acfP) HostName
+ Katip: itemHost :: forall a_a9QL. Lens' (Item a_a9QL) HostName
- Katip: itemLoc :: forall a_acfP. Lens' (Item a_acfP) (Maybe Loc)
+ Katip: itemLoc :: forall a_a9QL. Lens' (Item a_a9QL) (Maybe Loc)
- Katip: itemMessage :: forall a_acfP. Lens' (Item a_acfP) LogStr
+ Katip: itemMessage :: forall a_a9QL. Lens' (Item a_a9QL) LogStr
- Katip: itemNamespace :: forall a_acfP. Lens' (Item a_acfP) Namespace
+ Katip: itemNamespace :: forall a_a9QL. Lens' (Item a_a9QL) Namespace
- Katip: itemPayload :: forall a_acfP a_ag3i. Lens (Item a_acfP) (Item a_ag3i) a_acfP a_ag3i
+ Katip: itemPayload :: forall a_a9QL a_adAT. Lens (Item a_a9QL) (Item a_adAT) a_a9QL a_adAT
- Katip: itemProcess :: forall a_acfP. Lens' (Item a_acfP) ProcessID
+ Katip: itemProcess :: forall a_a9QL. Lens' (Item a_a9QL) ProcessID
- Katip: itemSeverity :: forall a_acfP. Lens' (Item a_acfP) Severity
+ Katip: itemSeverity :: forall a_a9QL. Lens' (Item a_a9QL) Severity
- Katip: itemThread :: forall a_acfP. Lens' (Item a_acfP) ThreadIdText
+ Katip: itemThread :: forall a_a9QL. Lens' (Item a_a9QL) ThreadIdText
- Katip: itemTime :: forall a_acfP. Lens' (Item a_acfP) UTCTime
+ Katip: itemTime :: forall a_a9QL. Lens' (Item a_a9QL) UTCTime
- Katip.Core: filterElems :: [Text] -> HashMap Text v -> HashMap Text v
+ Katip.Core: filterElems :: [Text] -> KeyMap v -> KeyMap v
- Katip.Core: itemApp :: forall a_acfP. Lens' (Item a_acfP) Namespace
+ Katip.Core: itemApp :: forall a_a9QL. Lens' (Item a_a9QL) Namespace
- Katip.Core: itemEnv :: forall a_acfP. Lens' (Item a_acfP) Environment
+ Katip.Core: itemEnv :: forall a_a9QL. Lens' (Item a_a9QL) Environment
- Katip.Core: itemHost :: forall a_acfP. Lens' (Item a_acfP) HostName
+ Katip.Core: itemHost :: forall a_a9QL. Lens' (Item a_a9QL) HostName
- Katip.Core: itemLoc :: forall a_acfP. Lens' (Item a_acfP) (Maybe Loc)
+ Katip.Core: itemLoc :: forall a_a9QL. Lens' (Item a_a9QL) (Maybe Loc)
- Katip.Core: itemMessage :: forall a_acfP. Lens' (Item a_acfP) LogStr
+ Katip.Core: itemMessage :: forall a_a9QL. Lens' (Item a_a9QL) LogStr
- Katip.Core: itemNamespace :: forall a_acfP. Lens' (Item a_acfP) Namespace
+ Katip.Core: itemNamespace :: forall a_a9QL. Lens' (Item a_a9QL) Namespace
- Katip.Core: itemPayload :: forall a_acfP a_ag3i. Lens (Item a_acfP) (Item a_ag3i) a_acfP a_ag3i
+ Katip.Core: itemPayload :: forall a_a9QL a_adAT. Lens (Item a_a9QL) (Item a_adAT) a_a9QL a_adAT
- Katip.Core: itemProcess :: forall a_acfP. Lens' (Item a_acfP) ProcessID
+ Katip.Core: itemProcess :: forall a_a9QL. Lens' (Item a_a9QL) ProcessID
- Katip.Core: itemSeverity :: forall a_acfP. Lens' (Item a_acfP) Severity
+ Katip.Core: itemSeverity :: forall a_a9QL. Lens' (Item a_a9QL) Severity
- Katip.Core: itemThread :: forall a_acfP. Lens' (Item a_acfP) ThreadIdText
+ Katip.Core: itemThread :: forall a_a9QL. Lens' (Item a_a9QL) ThreadIdText
- Katip.Core: itemTime :: forall a_acfP. Lens' (Item a_acfP) UTCTime
+ Katip.Core: itemTime :: forall a_a9QL. Lens' (Item a_a9QL) UTCTime
- Katip.Core: toKey :: a -> a
+ Katip.Core: toKey :: (Text, c) -> (Key, c)
- Katip.Scribes.Handle: toBuilders :: HashMap Text Value -> [[Builder]]
+ Katip.Scribes.Handle: toBuilders :: KeyMap Value -> [[Builder]]
- Katip.Scribes.Handle: toTxtKeyList :: HashMap Text v -> [(Text, v)]
+ Katip.Scribes.Handle: toTxtKeyList :: KeyMap v -> [(Text, v)]
Files
- changelog.md +4/−0
- katip.cabal +7/−7
- src/Katip/Core.hs +8/−0
- src/Katip/Format/Time.hs +20/−3
- test/Katip/Tests.hs +19/−2
- test/Katip/Tests/Scribes/Handle.hs +5/−0
changelog.md view
@@ -1,3 +1,7 @@+0.8.7.1+=======+* Text 2 compatibility [#138](https://github.com/Soostone/katip/pull/138)+ 0.8.7.0 ======= * Aeson 2 compatibility [#131](https://github.com/Soostone/katip/pull/131)
katip.cabal view
@@ -1,5 +1,5 @@ name: katip-version: 0.8.7.0+version: 0.8.7.1 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 == 8.0.1, GHC == 8.2.2, GHC == 8.4.3+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2 source-repository head type: git@@ -54,8 +54,8 @@ OverloadedStrings build-depends: base >=4.9.0.0 && <5- , aeson >=0.6- , async < 3.0.0.0+ , aeson >=1.0.0.0+ , async >= 2.0.0.0 && < 3.0.0.0 , auto-update >= 0.1 , bytestring >= 0.9 , containers >=0.4@@ -65,7 +65,7 @@ , old-locale >= 1.0 , string-conv >= 0.1 , template-haskell >= 2.8- , text >= 0.11+ , text >= 1.2.4.0 , time >= 1 , transformers >= 0.3 , transformers-compat@@ -73,13 +73,13 @@ , monad-control >= 1.0 , mtl >= 2.0 , transformers-base >= 0.3- , resourcet >= 1.1+ , resourcet >= 1.2.0 , scientific >= 0.3.3.0 , microlens >= 0.2.0.0 , microlens-th >= 0.1.0.0 , semigroups , unliftio-core >= 0.1- , stm >= 2.4+ , stm >= 2.4.4.1 hs-source-dirs: src default-language: Haskell2010
src/Katip/Core.hs view
@@ -70,6 +70,7 @@ import qualified Data.Map.Strict as M import Data.Maybe (fromMaybe) import Data.Semigroup as SG+import qualified Data.Set as Set import Data.String import Data.String.Conv import Data.Text (Text)@@ -437,6 +438,13 @@ mempty = SomeKeys [] mappend = (<>) ++-- | Compares two payload selections for equivalence. With SomeKeys, ordering+-- and duplicates are ignored.+equivalentPayloadSelection :: PayloadSelection -> PayloadSelection -> Bool+equivalentPayloadSelection AllKeys AllKeys = True+equivalentPayloadSelection (SomeKeys a) (SomeKeys b) = Set.fromList a == Set.fromList b+equivalentPayloadSelection _ _ = False ------------------------------------------------------------------------------- -- | Katip requires JSON objects to be logged as context. This
src/Katip/Format/Time.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ -- | Time and memory efficient time encoding helper functions. module Katip.Format.Time ( formatAsLogTime,@@ -11,7 +13,12 @@ import qualified Data.Text.Array as TA import Data.Text.Internal (Text (..)) import Data.Time (Day, DiffTime, UTCTime (..), toGregorian)-import Data.Word (Word16)+import Data.Word+#if MIN_VERSION_text(2,0,0)+ (Word8)+#else+ (Word16)+#endif import Unsafe.Coerce (unsafeCoerce) -- Note: All functions here are optimized to never allocate anything@@ -178,14 +185,24 @@ -- Copyright: (c) 2015-2016 Bryan O'Sullivan -- License: BSD3 -data T = T {-# UNPACK #-} !Word16 {-# UNPACK #-} !Word16+data T = T+#if MIN_VERSION_text(2,0,0)+ {-# UNPACK #-} !Word8 {-# UNPACK #-} !Word8+#else+ {-# UNPACK #-} !Word16 {-# UNPACK #-} !Word16+#endif twoDigits :: Int -> T twoDigits a = T (digit hi) (digit lo) where (hi, lo) = a `quotRem` 10 -digit :: Int -> Word16+digit :: Int ->+#if MIN_VERSION_text(2,0,0)+ Word8+#else+ Word16+#endif digit x = fromIntegral (x + 48) data TimeOfDay64
test/Katip/Tests.hs view
@@ -79,16 +79,33 @@ let everything = liftPayload (SimpleLogPayload [("foo", AnyLogPayload ("a" :: Text))]) conservative = liftPayload (ConservativePayload "always" "rarely") both = everything <> conservative- payloadKeys V2 both @?= SomeKeys ["often_shown", "rarely_shown", "foo"]- payloadKeys V1 both @?= SomeKeys ["often_shown", "foo"]+ assertEquivalentPayloadSelection+ (payloadKeys V2 both)+ (SomeKeys somePayloadKeys)+ assertEquivalentPayloadSelection+ (payloadKeys V1 both)+ (SomeKeys ["often_shown", "foo"]) ] +assertEquivalentPayloadSelection :: PayloadSelection -> PayloadSelection -> Assertion+assertEquivalentPayloadSelection a b+ | equivalentPayloadSelection a b = pure ()+ | otherwise = assertFailure ("Expected " <> show a <> " =~ " <> show b)+ #if MIN_VERSION_aeson(2, 0, 0) singletonMap :: K.Key -> v -> KM.KeyMap v singletonMap = KM.singleton #else singletonMap :: Text -> v -> HM.HashMap Text v singletonMap = HM.singleton+#endif++#if MIN_VERSION_unordered_containers(0, 2, 16)+somePayloadKeys :: [Text]+somePayloadKeys = ["rarely_shown", "often_shown", "foo"]+#else+somePayloadKeys :: [Text]+somePayloadKeys = ["often_shown", "rarely_shown", "foo"] #endif -------------------------------------------------------------------------------
test/Katip/Tests/Scribes/Handle.hs view
@@ -73,6 +73,11 @@ goldenTextPath = "test/Katip/Tests/Scribes/Handle-text-aeson2.golden" goldenJsonPath :: FilePath goldenJsonPath = "test/Katip/Tests/Scribes/Handle-json-aeson2.golden"+#elif MIN_VERSION_unordered_containers(0, 2, 16)+goldenTextPath :: FilePath+goldenTextPath = "test/Katip/Tests/Scribes/Handle-text-aeson2.golden"+goldenJsonPath :: FilePath+goldenJsonPath = "test/Katip/Tests/Scribes/Handle-json-aeson2.golden" #else goldenTextPath :: FilePath goldenTextPath = "test/Katip/Tests/Scribes/Handle-text.golden"