From f8cfe98d9c97668f1b0c6518874db8c863bda469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Mon, 11 Oct 2021 22:03:33 +0200 Subject: [PATCH] Include offlineimap and pid in non interactive logs This patch includes the "offlineimap" string and the proccess id in the output for non interactive logs and syslog logs. Now, the output is something like this (syslog): Oct 11 21:55:10 yangon offlineimap[635798]: Syncing foo: IMAP -> Maildir Oct 11 21:55:10 yangon offlineimap[635798]: Syncing foo bar: IMAP -> Maildir Oct 11 21:55:10 yangon offlineimap[635798]: Syncing INBOX: IMAP -> Maildir Oct 11 21:55:10 yangon offlineimap[635798]: Syncing bar: IMAP -> Maildir Oct 11 21:55:10 yangon offlineimap[635798]: Syncing Trash: IMAP -> Maildir Closes #88 --- offlineimap/ui/Noninteractive.py | 2 +- offlineimap/ui/UIBase.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/offlineimap/ui/Noninteractive.py b/offlineimap/ui/Noninteractive.py index 64e01a7..19fa44b 100644 --- a/offlineimap/ui/Noninteractive.py +++ b/offlineimap/ui/Noninteractive.py @@ -45,7 +45,7 @@ class Syslog(UIBase): # create syslog handler ch = logging.handlers.SysLogHandler('/dev/log') # create formatter and add it to the handlers - self.formatter = logging.Formatter("%(message)s") + self.formatter = logging.Formatter("offlineimap[%(process)d]: %(message)s") ch.setFormatter(self.formatter) # add the handlers to the logger self.logger.addHandler(ch) diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py index d49d564..3c6859c 100644 --- a/offlineimap/ui/UIBase.py +++ b/offlineimap/ui/UIBase.py @@ -99,7 +99,7 @@ class UIBase: # create syslog handler ch = logging.handlers.SysLogHandler('/dev/log') # create formatter and add it to the handlers - self.formatter = logging.Formatter("%(message)s") + self.formatter = logging.Formatter("offlineimap[%(process)d]: %(message)s") ch.setFormatter(self.formatter) # add the handlers to the logger self.logger.addHandler(ch)