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 <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Feng, Bob C
2019-07-31 13:33:31 +08:00
parent 4acae2b38e
commit 1a624dd7cf
3 changed files with 31 additions and 24 deletions

View File

@ -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)