-
Notifications
You must be signed in to change notification settings - Fork 891
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
fix(notifications): default templates and logic #1010
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1010 +/- ##
==========================================
+ Coverage 59.63% 59.80% +0.17%
==========================================
Files 22 22
Lines 1412 1428 +16
==========================================
+ Hits 842 854 +12
- Misses 500 502 +2
- Partials 70 72 +2
Continue to review full report at Codecov.
|
Also, this enables having the startup message being logged even if it's not wanted as a notification, it also changes said startup message to be a series of messages instead of a single one with newlines in it (which was not really supported in logfmt):
They are still batched up and sent as a single notification, so there should be no difference in the notifications. Also, this is how the closing messages look, no more raw printing to stdout:
And the same goes for notification errors when sending:
...and for template issues:
|
2687f8b
to
bdc267b
Compare
Is the Docker log supposed to look like this when no notifications are configured?
(changed the poll interval to 60 to test if it was related to the timing of the log entries) |
Sort of. It's not really necessary when you don't have any notifications of course... |
Any way to disable it? |
Follow up/continuation of #981.
This PR will fix the default report template to only output something if
Updated
orFailed
is non-zero. It also fixes the non-session notifications (like the startup info) which was just broken using the report notifications.Note that this aligns the notification behaviour roughly with how it works using legacy notifications, as no notifications will be sent when everything is "normal"/already updated.
the new default report template
To prevent the notifications from being sent, it skips notifications whenever the output of the template (whether legacy or report templates) is an empty string.
This fixes #1008
It also adds a "special" data field for logging that just marks a message as non-notification. This is so that we can still log using the appropriate log levels without having to worry about it getting sent as notifications.
This mainly concerns logs about the notifications themselves, which would cause loops etc.
Any log messages with the field
notify
set tono
is ignored.