granian icon indicating copy to clipboard operation
granian copied to clipboard

Feature Request: Access Log

Open timkofu opened this issue 1 year ago • 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

timkofu avatar Dec 05 '23 09:12 timkofu

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

gi0baro avatar Dec 10 '23 10:12 gi0baro

We also would appreciate such feature

aeb-dev avatar Jan 02 '24 09:01 aeb-dev

+1. Also, please support JSON.

nitrag avatar Jan 23 '24 00:01 nitrag

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 avatar Jan 26 '24 02:01 mikeckennedy

@mikeckennedy looks great! Can you share a code example? 🙏

nkhitrov avatar Feb 08 '24 06:02 nkhitrov

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

mikeckennedy avatar Feb 08 '24 17:02 mikeckennedy

+1

codedoga avatar Apr 05 '24 19:04 codedoga