Merge pull request #9772 from gibsondan/loggingflush

Closes #9733: Fix for logging handler flushing warnings in the middle of the docs build
This commit is contained in:
Takeshi KOMIYA 2021-10-31 01:17:59 +09:00 committed by GitHub
commit 745e11426f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,6 +171,11 @@ class MemoryHandler(logging.handlers.BufferingHandler):
def shouldFlush(self, record: logging.LogRecord) -> bool: def shouldFlush(self, record: logging.LogRecord) -> bool:
return False # never flush return False # never flush
def flush(self) -> None:
# suppress any flushes triggered by importing packages that flush
# all handlers at initialization time
pass
def flushTo(self, logger: logging.Logger) -> None: def flushTo(self, logger: logging.Logger) -> None:
self.acquire() self.acquire()
try: try: