Recently we decided to start using logfmt as logs format, which is a human (and machine) readable structured log format, that makes queries, filtering and analysis easy while keeping log lines clear for humans.
Last but not least it avoids bikeshedding about how to format log lines, so developers are free to spend their time bikeshedding on more interesting topics.
pretty_log is metadata centric, so it encourages use of Logger.metadata to keep track of all relevant information.
We also created a replacement plug for Plug.Logger (plug_logger_with_meta
) which logs requests with all relevant metadata.
This is how log lines look like when using both pretty_log and plug_logger_with_meta:
level=info ts=2019-10-28T16:57:41.087+01:00 msg="Got client request." method=GET request_path=/v1/autotestrealm/interfaces module=PlugMetadataLogger function=call/2 request_id=FdHav4gx9ruV1-QAACZi tag=got_client_req level=info ts=2019-10-28T16:57:41.110+01:00 msg="Sent reply." status_code=200 elapsed=22ms realm=autotestrealm module=PlugMetadataLogger function=call/2 request_id=FdHav4gx9ruV1-QAACZi tag=sent_reply
Hope you’ll find this useful
Let me know if you have any request/question/feedback.