packages feed

graflog 3.0.0 → 4.0.0

raw patch · 2 files changed

+11/−1 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Graflog.Logger: Variant :: Text -> [Log] -> Log
+ Graflog.Logger: instance (Graflog.Logger.ToLog a, Graflog.Logger.ToLog b) => Graflog.Logger.ToLog (Data.Either.Either a b)
+ Graflog.Logger: instance Graflog.Logger.ToLog a => Graflog.Logger.ToLog (GHC.Base.Maybe a)

Files

graflog.cabal view
@@ -1,5 +1,5 @@ name:                graflog-version:             3.0.0+version:             4.0.0 synopsis:            Monadic correlated log events description:         Please see README.md homepage:            https://github.com/m-arnold/graflog#readme
src/Graflog/Logger.hs view
@@ -31,6 +31,7 @@  data Log   = Dictionary (Map Text Log)+  | Variant Text [Log]   | List [Log]   | Message Text   | Redacted@@ -69,6 +70,14 @@ instance ToLog a => ToLog (Map Text a) where   toLog = Dictionary . fmap toLog +instance (ToLog a, ToLog b) => ToLog (Either a b) where+  toLog (Left l) = Variant "left" [toLog l]+  toLog (Right r) = Variant "right" [toLog r]++instance ToLog a => ToLog (Maybe a) where+  toLog (Just a) = Variant "some" [toLog a]+  toLog Nothing = Variant "none" []+ dictionary :: [(Text, Log)] -> Log dictionary = Dictionary . Map.fromList @@ -79,6 +88,7 @@   toJSON (Message a) = String a   toJSON (List a) = toJSON a   toJSON (Dictionary a) = toJSON a+  toJSON (Variant tag values) = toJSON $ Map.fromList [(tag, map toJSON values)]   toJSON Redacted = String "(REDACTED)"  class Monad m => Logger m where