agrafix / Spock

Another Haskell web framework for rapid development
https://www.spock.li
678 stars 56 forks source link

Custom logging using e.g. katip/monad-logger #137

Open mcfilib opened 6 years ago

mcfilib commented 6 years ago

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.

mcfilib commented 6 years ago

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

agrafix commented 6 years ago

I think the quickest way to achieve this is to add a logging interface to either:

mcfilib commented 6 years ago

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?

agrafix commented 6 years ago

A writeup on the Spock blog would also work for me.