[`logging.py`] set default `stderr` path if `None` (#25033)

set default logger
This commit is contained in:
Arthur 2023-07-24 14:31:45 +02:00 committed by GitHub
parent c9a82be592
commit 0906d21203
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -85,6 +85,10 @@ def _configure_library_root_logger() -> None:
# This library has already configured the library root logger.
return
_default_handler = logging.StreamHandler() # Set sys.stderr as stream.
# set defaults based on https://github.com/pyinstaller/pyinstaller/issues/7334#issuecomment-1357447176
if sys.stderr is None:
sys.stderr = open(os.devnull, "w")
_default_handler.flush = sys.stderr.flush
# Apply our default configuration to the library root logger.