mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-01 19:02:31 +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
@@ -945,12 +945,9 @@ class JobGenerator(object):
|
||||
|
||||
def add_section(self, section, workloads):
|
||||
new_node = self.root_node.add_section(section)
|
||||
log.indent()
|
||||
try:
|
||||
with log.indentcontext():
|
||||
for workload in workloads:
|
||||
new_node.add_workload(workload)
|
||||
finally:
|
||||
log.dedent()
|
||||
|
||||
def add_workload(self, workload):
|
||||
self.root_node.add_workload(workload)
|
||||
|
Reference in New Issue
Block a user