[elbe-devel] [PATCH 7/8] elbepack: log: simplify handler registration

Thomas Weißschuh thomas.weissschuh at linutronix.de
Fri Aug 9 14:47:22 CEST 2024


Remove one level of unnecessarily nested loops.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/log.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/elbepack/log.py b/elbepack/log.py
index 2179a0b7b7b0..22cda34a7dc7 100644
--- a/elbepack/log.py
+++ b/elbepack/log.py
@@ -108,7 +108,7 @@ def add_stream_handlers(streams):
                                     'echo',
                                     'soap']))
         out.setFormatter(context_fmt)
-        yield [out]
+        yield out
 
 
 def add_project_handlers(projects):
@@ -132,7 +132,7 @@ def add_project_handlers(projects):
         echo.setFormatter(context_fmt)
         soap.setFormatter(context_fmt)
 
-        yield [validation, report, log, echo, soap]
+        yield from [validation, report, log, echo, soap]
 
 
 _logging_methods = {
@@ -160,10 +160,9 @@ def open_logging(targets):
             if not isinstance(destinations, list):
                 destinations = [destinations]
 
-            for handlers in call(destinations):
-                for h in handlers:
-                    local.handlers.append(h)
-                    root.addHandler(h)
+            for h in call(destinations):
+                local.handlers.append(h)
+                root.addHandler(h)
 
 
 def close_logging():

-- 
2.46.0



More information about the elbe-devel mailing list