[elbe-devel] [PATCH 01/12] log: create class LoggingQueue(collections.deque)

Torben Hohn torben.hohn at linutronix.de
Thu Sep 26 15:33:21 CEST 2019


prepare to add a flag for error tracking into the QHandler.

Since we can have more than one Handler per project, we need to put
the flag into the single per project object, which will be the
LoggingQueue.

create it, and use it.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/log.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/elbepack/log.py b/elbepack/log.py
index c1747554a..9f3196031 100644
--- a/elbepack/log.py
+++ b/elbepack/log.py
@@ -21,6 +21,11 @@ msgonly_fmt = logging.Formatter("%(message)s")
 logging_methods = []
 
 
+class LoggingQueue(collections.deque):
+    def __init__(self):
+        super(LoggingQueue, self).__init__(maxlen=1024)
+
+
 class QHandler(logging.Handler):
 
     queues = {}
@@ -28,7 +33,7 @@ class QHandler(logging.Handler):
     def __init__(self, target, *args, **kwargs):
         super(QHandler, self).__init__(*args, **kwargs)
         if target not in QHandler.queues:
-            QHandler.queues[target] = collections.deque(maxlen=1024)
+            QHandler.queues[target] = LoggingQueue()
         self.Q = QHandler.queues[target]
 
     def emit(self, record):
-- 
2.20.1




More information about the elbe-devel mailing list