diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2022-06-07 12:59:18 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2022-06-07 18:17:02 +0300 |
commit | 867e172bf9c1095c0939551398b83ce47647d18f (patch) | |
tree | 8a5abb4e4afa2a4671a26f84e7f244a3ba27884e | |
parent | f2af73f6d9f220c3b3d211edfae4e69966f31beb (diff) |
Only mail leads log records of ERROR or higher
Emulate the behaviour of retainLevel=ERROR for the leads email, as we
had prior to a1cb1581.
-rwxr-xr-x | calm/calm.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/calm/calm.py b/calm/calm.py index 62dc902..63cdc60 100755 --- a/calm/calm.py +++ b/calm/calm.py @@ -630,12 +630,13 @@ def mail_cb(state, loghandler): if not state.args.email: return - # if there are any log records of ERROR level or higher, send all records to - # leads + # if there are any log records of ERROR level or higher, send those records + # to leads if any([record.levelno >= logging.ERROR for record in loghandler.buffer]): leads_email = BufferingSMTPHandler(state.args.email, subject='%s' % (state.subject)) for record in loghandler.buffer: - leads_email.handle(record) + if record.levelno >= logging.ERROR: + leads_email.handle(record) leads_email.close() # send each maintainer mail containing log entries caused by their actions, |