From 1a624dd7cf0db5783b27e18e6c790178d14a1e6a Mon Sep 17 00:00:00 2001 From: "Feng, Bob C" Date: Wed, 31 Jul 2019 13:33:31 +0800 Subject: BaseTools: Enable block queue log agent. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875 To support Ctrl+S and Ctrl+Q, we enable block queue for log. Cc: Liming Gao Signed-off-by: Bob Feng Acked-by: Laszlo Ersek Tested-by: Laszlo Ersek Acked-by: Liming Gao --- BaseTools/Source/Python/Common/EdkLogger.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'BaseTools/Source/Python/Common/EdkLogger.py') diff --git a/BaseTools/Source/Python/Common/EdkLogger.py b/BaseTools/Source/Python/Common/EdkLogger.py index 15fd1458a9..06da4a9d0a 100644 --- a/BaseTools/Source/Python/Common/EdkLogger.py +++ b/BaseTools/Source/Python/Common/EdkLogger.py @@ -95,7 +95,9 @@ except: self.enqueue(self.prepare(record)) except Exception: self.handleError(record) - +class BlockQueueHandler(QueueHandler): + def enqueue(self, record): + self.queue.put(record,True) ## Log level constants DEBUG_0 = 1 DEBUG_1 = 2 @@ -292,19 +294,19 @@ def LogClientInitialize(log_q): # # For DEBUG level (All DEBUG_0~9 are applicable) _DebugLogger.setLevel(INFO) - _DebugChannel = QueueHandler(log_q) + _DebugChannel = BlockQueueHandler(log_q) _DebugChannel.setFormatter(_DebugFormatter) _DebugLogger.addHandler(_DebugChannel) # For VERBOSE, INFO, WARN level _InfoLogger.setLevel(INFO) - _InfoChannel = QueueHandler(log_q) + _InfoChannel = BlockQueueHandler(log_q) _InfoChannel.setFormatter(_InfoFormatter) _InfoLogger.addHandler(_InfoChannel) # For ERROR level _ErrorLogger.setLevel(INFO) - _ErrorCh = QueueHandler(log_q) + _ErrorCh = BlockQueueHandler(log_q) _ErrorCh.setFormatter(_ErrorFormatter) _ErrorLogger.addHandler(_ErrorCh) -- cgit v1.2.3