katip 0.6.2.1 → 0.6.3.0
raw patch · 5 files changed
+27/−1 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Katip.Core: instance Data.Aeson.Types.FromJSON.FromJSON Katip.Core.Verbosity
+ Katip.Core: instance Data.Aeson.Types.ToJSON.ToJSON Katip.Core.Verbosity
- Katip: itemPayload :: forall a_ae56 a_ak7c. Lens (Item a_ae56) (Item a_ak7c) a_ae56 a_ak7c
+ Katip: itemPayload :: forall a_ae56 a_ak8O. Lens (Item a_ae56) (Item a_ak8O) a_ae56 a_ak8O
- Katip.Core: itemPayload :: forall a_ae56 a_ak7c. Lens (Item a_ae56) (Item a_ak7c) a_ae56 a_ak7c
+ Katip.Core: itemPayload :: forall a_ae56 a_ak8O. Lens (Item a_ae56) (Item a_ak8O) a_ae56 a_ak8O
Files
- README.md +1/−0
- changelog.md +4/−0
- katip.cabal +1/−1
- src/Katip/Core.hs +15/−0
- test/Katip/Tests.hs +6/−0
README.md view
@@ -86,3 +86,4 @@ * [Chris Martin](https://github.com/chris-martin) * [Domen Kožar](https://github.com/domenkozar) * [Tristan Bull](https://github.com/tmbull)+* [Aleksey Khudyakov](https://github.com/Shimuuar)
changelog.md view
@@ -1,3 +1,7 @@+0.6.3.0+=======+* Add `ToJSON`/`FromJSON` instances for Verbosity. Credit to [Aleksey Khudyakov](https://github.com/Shimuuar).+ 0.6.2.1 ======= * Add `mkHandleScribeWithFormatter`. This allows control over the format of log items going to a handle. Credit to [Tristan Bull](https://github.com/tmbull) for the implementation.
katip.cabal view
@@ -1,5 +1,5 @@ name: katip-version: 0.6.2.1+version: 0.6.3.0 synopsis: A structured logging framework. description: Katip is a structured logging framework. See README.md for more details.
src/Katip/Core.hs view
@@ -179,6 +179,21 @@ Just x -> return x Nothing -> fail $ "Invalid Severity " ++ toS t +instance ToJSON Verbosity where+ toJSON s = A.String $ case s of+ V0 -> "V0"+ V1 -> "V1"+ V2 -> "V2"+ V3 -> "V3"++instance FromJSON Verbosity where+ parseJSON = A.withText "Verbosity" $ \s -> case s of+ "V0" -> return V0+ "V1" -> return V1+ "V2" -> return V2+ "V3" -> return V3+ _ -> fail $ "Invalid Verbosity " ++ toS s+ ------------------------------------------------------------------------------- -- | Log message with Builder underneath; use '<>' to concat in O(1).
test/Katip/Tests.hs view
@@ -42,6 +42,8 @@ [ testProperty "JSON cycle Item" $ \(i :: Item ()) -> prop_json_cycle i+ , testProperty "JSON cycle verbosity" $ \(v :: Verbosity) ->+ prop_json_cycle v , eqItemTests , testProperty "renderSeverity/textToSeverity cycle" $ \sev -> textToSeverity(renderSeverity sev) === Just sev@@ -258,6 +260,10 @@ s <- arbitrary return $ Loc f p m s s ++-------------------------------------------------------------------------------+instance Arbitrary Verbosity where+ arbitrary = oneof $ map pure [V0, V1, V2, V3] ------------------------------------------------------------------------------- instance Arbitrary Severity where