@hackage co-log-json0.0.1.0

Structured messages support in co-log ecosystem.

The library implements of a very simple approach to structured logging, that ca be used with the co-log ecosystem or on it's own see cheops-logger.

It provides:

  • Colog.Json — API for adding structured context to the log messages

  • Colog.Json.Action — efficient function for dumping logs in the following format.

By default it emits logs in the following format (pretty-printed for convenience):

{ "namespace":"server.package" -- namespace for the component
, "severity": "DEBUG"          -- severity level
, "thread":19                  -- id of the thread that emitted the message
, "message":"some long text "  -- textual message itself
, "data":                      -- user data
   { "ip":"8.8.8.8"
   , "http.request_id":"b362cd5db5c193c05312af4d3a399955"
   , "http.method":"DELETE"
   , "http.path":"/url/"
   , "user_id":"123"
   } 
}

The most interesting thing here is the field data that can be used by the user to add additional structured info to the message.