-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Structured Logging #7
Comments
Some questions:
|
@snoyberg Thanks for the quick response! Re: questions.
Disclaimer: I’m an intermediate Haskeller and somewhat comfortable using monad transformers but don’t have experience writing them yet. I’d definitely appreciate some guidance. At the same time, our logging work has been lowered in priority so I’m not sure when I’ll be able to dedicate more time on this. There was also a recent announcement of The purpose of this issue was to assess the need / desire for structured logging on your end and bounce around ideas before starting to work on implementation 😄 |
Regardless of whether we do a subclass, I think you're going to need a new concrete monad transformer type to allow you the flexibility to provide your own special handling of JSON values. |
@snoyberg Would you mind elaborating on that or give a small example? |
To see it, try implementing the |
First of all, thanks for this useful library!
We use
monad-logger
for logging in our system. We are now moving towards logging structured data using JSON, e.g.Example
Before
After
However, the current implementation of
monad-logger
doesn’t support this well as only a singleToLogStr
message can be logged.Proposal (draft)
Would you be open to extend the type-class to support structured logging, e.g.
Prior Art
There are existing libraries such as
monad-log
that offer something similar but we have found them harder to integrate as they were missing some of the monad instances thatmonad-logger
offers and were generally not as mature.Workarounds
These are potential workarounds for the current setup:
LogStr
tomonad-logger
to reuse its monad instances.monad-logger
and extend it to support structured data.Neither of these are very appealing.
Conclusion
As systems grow, logging becomes more critical. Aggregators such as Splunk, SumoLogic, etc. offer support for structured logs, e.g. JSON.
monad-logger
should support it out-of-the-box as well. The proposal above is one approach and feedback is welcome. If there is interest to add this tomonad-logger
, I’d be happy to contribute a PR. Thanks!The text was updated successfully, but these errors were encountered: