summaryrefslogtreecommitdiffstats
path: root/wallace/modules.py
diff options
context:
space:
mode:
authorLiutauras Adomaitis <adomaitis@kolabsystems.com>2019-08-16 13:56:23 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2019-08-16 13:56:23 +0200
commit775aa79262cace87c2443475c11abb9e5b609fe4 (patch)
tree86be8e4251e9855abb22ae00f7ccf8446d0ec9cb /wallace/modules.py
parent88a6fa3f29f9bd937186f9dceb8d880b8af7692b (diff)
downloadpykolab-775aa79262cace87c2443475c11abb9e5b609fe4.tar.gz
More logging in Wallace and --max-tasks per process option for wallaced
Summary: Given that part of https://git.kolab.org/D761 changes are obsolete after commit baeee0049f06430801a2d9940f875747e51be7f5 I still want to have some changes find their way in master. Test Plan: None Reviewers: vanmeeuwen Subscribers: petersen, machniak, vanmeeuwen Differential Revision: https://git.kolab.org/D791
Diffstat (limited to 'wallace/modules.py')
-rw-r--r--wallace/modules.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/wallace/modules.py b/wallace/modules.py
index bb37eb0..cab1e1b 100644
--- a/wallace/modules.py
+++ b/wallace/modules.py
@@ -42,7 +42,10 @@ import pykolab
from pykolab import constants
from pykolab.translate import _
-log = pykolab.getLogger('pykolab.wallace')
+log = pykolab.getLogger('pykolab.wallace/modules')
+extra_log_params = {'qid': '-'}
+log = pykolab.logger.LoggerAdapter(log, extra_log_params)
+
conf = pykolab.getConf()
modules = {}
@@ -204,9 +207,17 @@ def _sendmail(sender, recipients, msg):
return success
def cb_action_HOLD(module, filepath):
+ global extra_log_params
+
+ extra_log_params['qid'] = os.path.basename(filepath)
+
log.info(_("Holding message in queue for manual review (%s by %s)") % (filepath, module))
def cb_action_DEFER(module, filepath):
+ global extra_log_params
+
+ extra_log_params['qid'] = os.path.basename(filepath)
+
log.info(_("Deferring message in %s (by module %s)") % (filepath, module))
# parse message headers
@@ -250,6 +261,10 @@ def cb_action_DEFER(module, filepath):
#os.unlink(filepath)
def cb_action_REJECT(module, filepath):
+ global extra_log_params
+
+ extra_log_params['qid'] = os.path.basename(filepath)
+
log.info(_("Rejecting message in %s (by module %s)") % (filepath, module))
log.debug(_("Rejecting message in: %r") %(filepath), level=8)
@@ -336,6 +351,10 @@ X-Wallace-Result: REJECT
def cb_action_ACCEPT(module, filepath):
+ global extra_log_params
+
+ extra_log_params['qid'] = os.path.basename(filepath)
+
log.info(_("Accepting message in %s (by module %s)") % (filepath, module))
log.debug(_("Accepting message in: %r") %(filepath), level=8)