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:
committed by
Marc Bonnici
parent
c1a0f842d0
commit
ecc68ee367
@@ -38,12 +38,9 @@ class JobSpecSource(object):
|
||||
|
||||
def _log_self(self):
|
||||
logger.debug('Creating {} node'.format(self.kind))
|
||||
log.indent()
|
||||
try:
|
||||
with log.indentcontext():
|
||||
for key, value in self.config.iteritems():
|
||||
logger.debug('"{}" to "{}"'.format(key, value))
|
||||
finally:
|
||||
log.dedent()
|
||||
|
||||
|
||||
class WorkloadEntry(JobSpecSource):
|
||||
|
Reference in New Issue
Block a user