[elbe-devel] [PATCH 5/7] elbepack: log: remove public max_level attribute

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Aug 19 16:50:17 CEST 2024


The proxy objects generated by multiprocessing do not handle attribute
access. Instead do everything through methods.

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

diff --git a/elbepack/log.py b/elbepack/log.py
index b5a7c222f03e..0ca828dfb999 100644
--- a/elbepack/log.py
+++ b/elbepack/log.py
@@ -24,11 +24,17 @@ validation = logging.getLogger('validation')
 class LoggingQueue(collections.deque):
     def __init__(self):
         super().__init__(maxlen=1024)
-        self.max_level = logging.NOTSET
+        self._max_level = logging.NOTSET
 
     def note_level(self, level):
-        if level > self.max_level:
-            self.max_level = level
+        if level > self._max_level:
+            self._max_level = level
+
+    def reset_level(self):
+        self._max_level = logging.NOTSET
+
+    def max_level(self):
+        return self._max_level
 
 
 _queues = {}
@@ -55,14 +61,14 @@ def read_loggingQ(proj):
 
 def read_maxlevel(proj):
     try:
-        return _queues[proj].max_level
+        return _queues[proj].max_level()
     except (IndexError, KeyError):
         return logging.NOTSET
 
 
 def reset_level(proj):
     try:
-        _queues[proj].max_level = logging.NOTSET
+        _queues[proj].reset_level()
     except (IndexError, KeyError):
         pass
 

-- 
2.46.0



More information about the elbe-devel mailing list