graflog 6.1.1 → 6.1.2
raw patch · 2 files changed
+33/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +32/−0
- graflog.cabal +1/−1
README.md view
@@ -4,6 +4,38 @@ ##To Use: +- given a data type:+ ```+ data UserSpec = UserSpec+ { email :: Email+ , password :: Text+ , name :: Text+ } deriving (Eq, Show, Generic)+ ```++ we can create an instance of ToLog:+ ```+ instance ToLog UserSpec where+ toLog UserSpec{email, name} =+ dictionary+ [ pair "email" email+ , pair "password" Redacted+ , pair "name" name ]+ ```++ and derive JSON instances of that:+ ```+ deriveJSON defaultOptions ''UserSpec+ ```++ which can then be logged inside a monad:+ ```+ foo = do+ let jimbo = UserSpec (Email "jimbo@gmail.com" ...)+ logJSON $ Event (CorrelationId 0) (EventId 0) "User" (toLog jimbo)+ return jimbo+ ```+ - you must force stdout to flush after each line, or logs won't appear in a timely manner: call `Graflog.Console.enableStdoutLineBuffering` at the top of your main function. - CorrelationId and EventId generation are not yet supported, so you must create an event manually:
graflog.cabal view
@@ -1,5 +1,5 @@ name: graflog-version: 6.1.1+version: 6.1.2 synopsis: Monadic correlated log events description: Please see README.md homepage: https://github.com/m-arnold/graflog#readme