[elbe-devel] [PATCH 3/8] elbepack: remove files logging

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


It is only used once during testing and that usage can be replaced
trivially with streams logging.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/log.py         | 21 ---------------------
 elbepack/shellhelper.py |  2 +-
 2 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/elbepack/log.py b/elbepack/log.py
index 330f36fe6008..d7b66b1e2497 100644
--- a/elbepack/log.py
+++ b/elbepack/log.py
@@ -7,7 +7,6 @@ import collections
 import logging
 import os
 import re
-import sys
 import threading
 from contextlib import contextmanager
 
@@ -162,26 +161,6 @@ def add_project_handlers(projects):
         yield [validation, report, log, echo, soap]
 
 
- at logging_method('files')
- at with_list
-def add_file_handlers(files):
-
-    for f in files:
-        if f is None:
-            out = logging.StreamHandler(sys.stdout)
-        else:
-            out = logging.FileHandler(f)
-        out.addFilter(ThreadFilter(['root',
-                                    'log',
-                                    'report',
-                                    'validation',
-                                    'echo',
-                                    'soap']))
-        out.setFormatter(context_fmt)
-
-        yield [out]
-
-
 @contextmanager
 def elbe_logging(*args, **kwargs):
     try:
diff --git a/elbepack/shellhelper.py b/elbepack/shellhelper.py
index 108bce09f914..ac68e84d8dcc 100644
--- a/elbepack/shellhelper.py
+++ b/elbepack/shellhelper.py
@@ -43,7 +43,7 @@ def run(cmd, /, *, check=True, log_cmd=None, **kwargs):
     >>> import os
     >>> import sys
     >>> from elbepack.log import open_logging
-    >>> open_logging({"files":os.devnull})
+    >>> open_logging({"streams":os.devnull})
 
     >>> run(['echo', 'ELBE'])
     CompletedProcess(args=['echo', 'ELBE'], returncode=0)

-- 
2.46.0



More information about the elbe-devel mailing list