Skip to content

Commit

Permalink
Avoid string formatting in log call
Browse files Browse the repository at this point in the history
Remove handler and warning.warn
  • Loading branch information
groutr committed Nov 18, 2016
1 parent ba94bac commit bb39be8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions odo/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .utils import expand_tuples, ignoring

log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())

ooc_types = set() # Out-of-Core types

Expand Down Expand Up @@ -58,17 +57,20 @@ def _transform(graph, target, source, excluded_edges=None, ooc_types=ooc_types,
pth = path(graph, type(source), target,
excluded_edges=excluded_edges,
ooc_types=ooc_types)

try:
for (A, B, f) in pth:
log.debug('[{src} -> {dest}] {f} ({kwargs})'.format(f=f.__name__,
kwargs=kwargs, src=A.__name__, dest=B.__name__))
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)
return x
except NotImplementedError as e:
if kwargs.get('raise_on_errors'):
raise
warn(FailedConversionWarning(A, B, e))
log.warning('Failed Conversion {} -> {} ({})'.format(A, B, str(e)))
log.warning('Failed on %s -> %s. Working around\nError message:\n%s',
A.__name__, B.__name__, e
)
new_exclusions = excluded_edges | set([(A, B)])
return _transform(graph, target, source, excluded_edges=new_exclusions,
**kwargs)
Expand Down

0 comments on commit bb39be8

Please sign in to comment.