tiny-pilot / tinypilot

Use your Raspberry Pi as a browser-based KVM.
https://tinypilotkvm.com
MIT License
3.02k stars 252 forks source link

Specify Flask logging level via CLI #1674

Open jdeanwallace opened 11 months ago

jdeanwallace commented 11 months ago

While reviewing https://github.com/tiny-pilot/tinypilot/pull/1666, @jotaen4tinypilot suggested we suppress some of the Flask logging when running Flask in CLI commands. Example of logs to suppress:

$ FLASK_APP=app/main.py flask cli streaming-mode
2023-10-30 20:08:12.626 app.main        INFO Starting app
2023-10-30 20:08:12.658 db.store        INFO Loading database migrations from /opt/tinypilot/app/db/migrations/*.sql
2023-10-30 20:08:12.660 db.store        INFO Read 7 database migrations from disk
H264

It seems like we'll need to allow app/main.py to dynamically set the log level based on an environment variable: https://github.com/tiny-pilot/tinypilot/blob/959a5a8f0e0fa138ccc2cd3cc7ba46f497e4d4c6/app/main.py#L30