emmett-framework / granian

A Rust HTTP server for Python applications
BSD 3-Clause "New" or "Revised" License
2.67k stars 79 forks source link

Log to a file - AKA need to document log-config format #190

Closed mikeckennedy closed 8 months ago

mikeckennedy commented 8 months ago

Hey, thanks for making this! I'm excited to try it out. I'm replacing gunicorn+uvicorn workers. Over there, I have a log file for my app code and a log file the output of gunicorn (requests, timing, etc). I see there is a log-config option to pass a JSON config. But, maybe I missed it, I don't see any example or information on what goes into this JSON document.

I did look in log.py but it only has options for logging to the console as well.

Maybe I'm hoping for Feature Request: Access Log #152 ? Not sure. But if so, +1 for that. But nonetheless even a tiny bit of info on what to put into that json config would be welcomed.

gi0baro commented 8 months ago

Hey @mikeckennedy, the JSON configuration is just a standard logging dictconfig dumped.

Let me know if you need any additional info on this or I can close it.

mikeckennedy commented 8 months ago

Hi. Go ahead and close it. But it might be worth adding that sentence to the help output:

  --log-config FILE     Logging configuration file (json)  [env var: GRANIAN_LOG_CONFIG]
                        The format is Python's configuration dictionary schema format.

PS - Sent you an email too about this project but unrelated to this issue.