emmett-framework/granian

Feature Request: Access Log

timkofu opened this issue ยท 7 comments

Is it within your vision for the project to have an access log similar to Gunicorn's default?

192.168.0.192 - - [05/Dec/2023:09:40:08 +0000] "GET / HTTP/1.1" 302 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0"

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar

This is something that will require some analysis, but only after #25 is done

We also would appreciate such feature

+1. Also, please support JSON.

For what it's worth, I added some middleware for my web app and got what I was hoping plus more with color and all to highlight abnormalities (high latency, size, etc). Just in case others are waiting on something like this to adopt the server. Rolling your own isn't too bad.

colored

It's not an exact replica of the format of gunicorn but I didn't want that anyway.

@mikeckennedy looks great! Can you share a code example? ๐Ÿ™

Hi @nkhitrov I'm happy to share. Every web framework is a bit different. That log is from Pyramid so is handled through their "Tweens" but more general plugs into whatever middleware stack there is. Here's what generated that out put. I really like the coloring of errors and slow requests differently, etc.

https://gist.github.com/mikeckennedy/6e4f7b9e8bf3771c4b0b5cee6e03b29a