From be0ca7b605821910dc696f681b9a22769780735a Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 17 May 2013 13:25:18 -0700 Subject: [PATCH] Use a different logger method if tolerant vs not tolerant. --- taskflow/patterns/ordered_workflow.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/taskflow/patterns/ordered_workflow.py b/taskflow/patterns/ordered_workflow.py index 8b9340c5..24813d8b 100644 --- a/taskflow/patterns/ordered_workflow.py +++ b/taskflow/patterns/ordered_workflow.py @@ -249,10 +249,12 @@ class Workflow(object): except Exception: # Ex: WARN: Failed rolling back stage 1 (validate_request) of # chain validation due to Y exception. + log_f = LOG.warn + if not self.tolerant: + log_f = LOG.exception msg = ("Failed rolling back stage %(index)s (%(task)s)" " of workflow %(workflow)s, due to inner exception.") - LOG.warn(msg % {'index': (i + 1), 'task': task, - 'workflow': self}) + log_f(msg % {'index': (i + 1), 'task': task, 'workflow': self}) if not self.tolerant: # NOTE(harlowja): LOG a msg AND re-raise the exception if # the chain does not tolerate exceptions happening in the