-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvement: More mature logging approach #88
Comments
Thanks for the suggestions. So there is structured logging available, but I specifically opted to use the colored format for console logging since it's a little easier to read. However, you can enable JSON logging with an environment variable if you would like. Here's a sample: {"level":"debug","time":"2024/06/10 10:26:57","message":"Debug logging enabled"}
{"level":"info","time":"2024/06/10 10:26:57","message":"Frigate Notify - v0.3.1-dev"}
{"level":"info","time":"2024/06/10 10:26:57","message":"Starting..."}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Loading config file: ./config.yml"}
{"level":"info","time":"2024/06/10 10:26:57","message":"Config file loaded."}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Validating config file..."}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Checking connection to Frigate server..."}
{"level":"info","time":"2024/06/10 10:26:57","message":"Successfully connected to http://nvr"}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Frigate server is running version 0.14.0-bccffe6"}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Cameras to exclude from alerting:"}
{"level":"debug","time":"2024/06/10 10:26:57","message":" - test123"}
{"level":"debug","time":"2024/06/10 10:26:57","message":"MQTT Enabled."}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Events without a snapshot: drop"}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Events outside a zone: allow"}
{"level":"debug","time":"2024/06/10 10:26:57","message":"All zones included in alerts"}
{"level":"debug","time":"2024/06/10 10:26:57","message":"No zones excluded"}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Labels to generate alerts for:"}
{"level":"debug","time":"2024/06/10 10:26:57","message":" - person"}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Labels to exclude from alerting:"}
{"level":"debug","time":"2024/06/10 10:26:57","message":" - dog"}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Discord alerting enabled."}
{"level":"info","time":"2024/06/10 10:26:57","message":"Config file validated!"}
{"level":"debug","time":"2024/06/10 10:26:57","message":"Connecting to MQTT Server..."}
{"level":"info","time":"2024/06/10 10:26:57","message":"App running. Press Ctrl-C to quit."}
{"level":"info","time":"2024/06/10 10:26:57","message":"Connected to MQTT."}
{"level":"info","time":"2024/06/10 10:26:57","message":"Subscribed to MQTT topic: fndev/events"}
{"level":"info","event_id":"1718029715.95222-743z1b","time":"2024/06/10 10:28:37","message":"New event received"}
{"level":"info","event_id":"1718029715.95222-743z1b","camera":"test_cam","label":"person","zones":"","time":"2024/06/10 10:28:37","message":"Event Detected"}
{"level":"debug","event_id":"1718029715.95222-743z1b","time":"2024/06/10 10:28:37","message":"Event start time: 2024-06-10 10:28:35 EDT"}
{"level":"info","event_id":"1718029715.95222-743z1b","time":"2024/06/10 10:28:37","message":"Event dropped - No snapshot available"}
{"level":"info","event_id":"1718029715.95222-743z1b","time":"2024/06/10 10:28:41","message":"Event update received"}
{"level":"info","event_id":"1718029715.95222-743z1b","camera":"test_cam","label":"person","zones":"test_zone","time":"2024/06/10 10:28:41","message":"Event Detected"}
{"level":"debug","event_id":"1718029715.95222-743z1b","time":"2024/06/10 10:28:41","message":"Event start time: 2024-06-10 10:28:35 EDT"}
{"level":"debug","event_id":"1718029715.95222-743z1b","camera":"test_cam","label":"person","zones":"test_zone","time":"2024/06/10 10:28:41","message":"Object entered new zone"}
{"level":"info","event_id":"1718029715.95222-743z1b","provider":"Discord","time":"2024/06/10 10:28:41","message":"Alert sent"} I'm good with adding the time zone & calling module to the logs 👍 |
Hi @0x2142, having the colored text/plain logs in modern container orchestration systems (e.g., Kubernetes) can lead to the following side effect:
Maybe the Zulu time is more appropriate instead of exposing TZ. |
Ah, so the JSON logs have no color applied. The example above only shows colors because of the syntax highlighting for JSON. Sorry if that was confusing. It does look like zerolog also supports disabling colors on ConsoleWriter - so I can add something to optionally disable that too. |
|
Is your feature request related to a problem? Please describe.
With the current logging approach it's not so easy to distinguish happened things from the logs:
The user cannot easily understand:
Describe the solution you'd like
More mature logging can be conceptualized as:
References
The text was updated successfully, but these errors were encountered: