1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 19:32:34 +01:00

utils/log: add indentcontext

Add indentcontext context manager to save having to add try/finally
clauses around indenting code just to ensure dedenting.
This commit is contained in:
sergei Trofimov
2018-04-30 13:13:57 +01:00
committed by Marc Bonnici
parent c1a0f842d0
commit ecc68ee367
5 changed files with 14 additions and 17 deletions

View File

@@ -626,8 +626,7 @@ class PluginLoader(object):
def _discover_in_module(self, module): # NOQA pylint: disable=too-many-branches
self.logger.debug('Checking module %s', module.__name__)
log.indent()
try:
with log.indentcontext():
for obj in vars(module).itervalues():
if inspect.isclass(obj):
if not issubclass(obj, Plugin):
@@ -647,9 +646,6 @@ class PluginLoader(object):
self.logger.warning(e)
else:
raise e
finally:
log.dedent()
pass
def _add_found_plugin(self, obj):
"""