Custom logging using e.g. katip/monad-logger
Hey folks, thanks for writing Spock!
This might not be the place for this request but I was wondering if you could perhaps add some advice to the documentation about how Spock users should go about adding logging to a Spock application. I know there are things like wai-extras that have a wai middleware for logging requests but, at least in the applications I work on, I'd also like to do some custom logging.
Specifically, I'm interested in how I should go about integrating with common libraries like monad-logger or katip but I'd appreciate any general advice you have.
I've added a repo with a minimal Spock app here on the offhand that someone has already done this in the past 😄
https://github.com/filib/spock-katip-example/blob/master/app/Main.hs
I think the quickest way to achieve this is to add a logging interface to either:
- add a logging interface data type to your
stparam which you can get viagetState. Write some combinators to wrap this neatly. - use a logging solution that uses a global logger like simple-logger
- send a PR to support logging within Spock :-)
I had to get things up and running quickly and simple-logger was just the ticket. Do you think that this would make a good Spock tutorial or would you prefer it be done on e.g. a personal blog post instead?
A writeup on the Spock blog would also work for me.