summaryrefslogtreecommitdiff
path: root/taskflow
diff options
context:
space:
mode:
authorIvan Kolodyazhny <e0ne@e0ne.info>2016-09-07 13:03:37 +0300
committerIvan Kolodyazhny <e0ne@e0ne.info>2016-09-08 06:26:15 +0000
commite8b1d580912a228d990e496663ddb16ce10db724 (patch)
treefc43d6e52d4dec9c04910b7cd23ca0c6c6cf98ec /taskflow
parentdf10cb5acc7d38c7bbe6f06f42393969b40e31ac (diff)
downloadtaskflow-e8b1d580912a228d990e496663ddb16ce10db724.tar.gz
Make failure formatter configurable for DynamicLoggingListener
DynamicLoggingListener uses only formatters.FailureFormatter to format errors. We should have API to pass formatter instance to DynamicLoggingListener to make it more flexible. Change-Id: I9658fbac97e4074b551a50d6016a92806a3636c1 Implements: blueprint dynamic-logging-listener-formatter-support
Diffstat (limited to 'taskflow')
-rw-r--r--taskflow/listeners/logging.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/taskflow/listeners/logging.py b/taskflow/listeners/logging.py
index ac1ecff..36b767d 100644
--- a/taskflow/listeners/logging.py
+++ b/taskflow/listeners/logging.py
@@ -111,7 +111,8 @@ class DynamicLoggingListener(base.Listener):
flow_listen_for=base.DEFAULT_LISTEN_FOR,
retry_listen_for=base.DEFAULT_LISTEN_FOR,
log=None, failure_level=logging.WARNING,
- level=logging.DEBUG, hide_inputs_outputs_of=()):
+ level=logging.DEBUG, hide_inputs_outputs_of=(),
+ fail_formatter=None):
super(DynamicLoggingListener, self).__init__(
engine, task_listen_for=task_listen_for,
flow_listen_for=flow_listen_for, retry_listen_for=retry_listen_for)
@@ -129,8 +130,12 @@ class DynamicLoggingListener(base.Listener):
}
self._hide_inputs_outputs_of = frozenset(hide_inputs_outputs_of)
self._logger = misc.pick_first_not_none(log, self._LOGGER, LOG)
- self._fail_formatter = formatters.FailureFormatter(
- self._engine, hide_inputs_outputs_of=self._hide_inputs_outputs_of)
+ if fail_formatter is None:
+ self._fail_formatter = formatters.FailureFormatter(
+ self._engine,
+ hide_inputs_outputs_of=self._hide_inputs_outputs_of)
+ else:
+ self._fail_formatter = fail_formatter
def _flow_receiver(self, state, details):
"""Gets called on flow state changes."""