[elbe-devel] [PATCH 6/8] elbepack: log: drop logging_method decorator
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Fri Aug 9 14:47:21 CEST 2024
The decorated functions are only called from one callsite.
Simplify the logic by moving the transformation to that callsite.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/log.py | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/elbepack/log.py b/elbepack/log.py
index 834f7bc2e527..2179a0b7b7b0 100644
--- a/elbepack/log.py
+++ b/elbepack/log.py
@@ -97,16 +97,6 @@ class ThreadFilter(logging.Filter):
return retval
-def logging_method(func):
- def wrapper(*args, **kwargs):
- for handlers in func(*args, **kwargs):
- for h in handlers:
- local.handlers.append(h)
- root.addHandler(h)
- return wrapper
-
-
- at logging_method
def add_stream_handlers(streams):
for stream in streams:
@@ -121,7 +111,6 @@ def add_stream_handlers(streams):
yield [out]
- at logging_method
def add_project_handlers(projects):
for proj in projects:
@@ -171,7 +160,10 @@ def open_logging(targets):
if not isinstance(destinations, list):
destinations = [destinations]
- call(destinations)
+ for handlers in call(destinations):
+ for h in handlers:
+ local.handlers.append(h)
+ root.addHandler(h)
def close_logging():
--
2.46.0
More information about the elbe-devel
mailing list