|
|
@@ -470,17 +470,24 @@ def main(argv: typing.List[str]): |
|
|
|
if email and not args.dry_run: |
|
|
|
backup.log('I', f"sending error notification to {email}") |
|
|
|
|
|
|
|
# Show all of our log output. Use a ":" prefix for |
|
|
|
# warnings, errors, and notices so that they get |
|
|
|
# highlighted by the mail reader. |
|
|
|
body = [ "Logs:" ] |
|
|
|
for (letter, msg) in backup.logs: |
|
|
|
if letter in "EWN": |
|
|
|
prefix = ":" |
|
|
|
else: |
|
|
|
prefix = " " |
|
|
|
body.append(f"{prefix}{letter}: {msg}") |
|
|
|
body_text = "\n".join(body).encode() |
|
|
|
def write_logs(title, only_include=None): |
|
|
|
body = [ title ] |
|
|
|
for (letter, msg) in backup.logs: |
|
|
|
if only_include and letter not in only_include: |
|
|
|
continue |
|
|
|
# Use a ":" prefix for warnings/errors/notices so that |
|
|
|
# the mail reader highlights them. |
|
|
|
if letter in "EWN": |
|
|
|
prefix = ":" |
|
|
|
else: |
|
|
|
prefix = " " |
|
|
|
body.append(f"{prefix}{letter}: {msg}") |
|
|
|
return "\n".join(body).encode() |
|
|
|
|
|
|
|
|
|
|
|
body_text = write_logs("Logged errors and warnings:", "EWN") |
|
|
|
body_text += "\n" |
|
|
|
body_text += write_logs("All logs:") |
|
|
|
|
|
|
|
# Subject summary |
|
|
|
if errmsg and warnmsg: |
|
|
|