From 279b889efe1d3ad5e3310de709c033593a31e49e Mon Sep 17 00:00:00 2001 From: Ryan Grout Date: Tue, 15 Nov 2016 20:11:55 -0600 Subject: [PATCH 1/2] Add rudimentry debug logging to odo. --- odo/core.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/odo/core.py b/odo/core.py index b1dd9ee8..5562482b 100644 --- a/odo/core.py +++ b/odo/core.py @@ -1,5 +1,6 @@ from __future__ import absolute_import, division, print_function +import logging from collections import namedtuple from contextlib import contextmanager from warnings import warn @@ -10,6 +11,7 @@ from .compatibility import map from .utils import expand_tuples, ignoring +log = logging.getLogger(__name__) ooc_types = set() # Out-of-Core types @@ -101,11 +103,16 @@ def _transform(graph, target, source, excluded_edges=None, ooc_types=ooc_types, path_proxy = IterProxy(pth) for convert_from, convert_to, f, cost in path_proxy: try: + log.debug('Transforming %s -> %s', A.__name__, B.__name__, + extra={'kwargs': kwargs, 'f': f, 'excluded_edges': excluded_edges} + ) x = f(x, excluded_edges=excluded_edges, **kwargs) except NotImplementedError as e: if kwargs.get('raise_on_errors'): raise - warn(FailedConversionWarning(convert_from, convert_to, e)) + log.warning('Failed on %s -> %s. Working around\nError message:\n%s', + A.__name__, B.__name__, e + ) # exclude the broken edge excluded_edges |= {(convert_from, convert_to)} From 93df92a16c434135efeb48135872ddfd1e4496f6 Mon Sep 17 00:00:00 2001 From: Ryan Grout Date: Thu, 15 Dec 2016 00:13:12 -0600 Subject: [PATCH 2/2] Update variable names. Add cost to debug message. --- odo/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/odo/core.py b/odo/core.py index 5562482b..e4d3e3fd 100644 --- a/odo/core.py +++ b/odo/core.py @@ -103,15 +103,15 @@ def _transform(graph, target, source, excluded_edges=None, ooc_types=ooc_types, path_proxy = IterProxy(pth) for convert_from, convert_to, f, cost in path_proxy: try: - log.debug('Transforming %s -> %s', A.__name__, B.__name__, - extra={'kwargs': kwargs, 'f': f, 'excluded_edges': excluded_edges} + log.debug('Transforming %s -> %s', convert_from.__name__, convert_to.__name__, + extra={'kwargs': kwargs, 'f': f, 'excluded_edges': excluded_edges, 'cost': cost} ) x = f(x, excluded_edges=excluded_edges, **kwargs) except NotImplementedError as e: if kwargs.get('raise_on_errors'): raise log.warning('Failed on %s -> %s. Working around\nError message:\n%s', - A.__name__, B.__name__, e + convert_from.__name__, convert_to.__name__, e ) # exclude the broken edge