Use a class provided logger before falling back to module

If a subclass overrides the logging listeners and provides
a class specific logger (under the attribute named _LOGGER)
try to use that before using the taskflow specific logging
module (and only use this one as a last resort).

This allows subclasses to easily override the default logger
without having to continually pass in a constructor argument
to do the same.

Change-Id: I91fea3db6cdd1dfb39963ff9589fd530fe087278
This commit is contained in:
Joshua Harlow
2015-01-21 17:07:13 -08:00
parent 2d9b5a8d92
commit 5773fb09e6
2 changed files with 26 additions and 15 deletions

View File

@@ -112,6 +112,14 @@ def find_subclasses(locations, base_cls, exclude_hidden=True):
return derived
def pick_first_not_none(*values):
"""Returns first of values that is *not* None (or None if all are/were)."""
for val in values:
if val is not None:
return val
return None
def parse_uri(uri):
"""Parses a uri into its components."""
# Do some basic validation before continuing...