mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-09 18:09:17 +08:00
Make filename, stream, and handlers parameters of logging.basicConfig mutually-exclusive (#15435)
This commit is contained in:
@@ -28,3 +28,27 @@ logging.handlers.QueueHandler(multiprocessing.Queue())
|
||||
logging.handlers.QueueListener(queue.Queue())
|
||||
logging.handlers.QueueListener(queue.SimpleQueue())
|
||||
logging.handlers.QueueListener(multiprocessing.Queue())
|
||||
|
||||
# These all raise at runtime.
|
||||
logging.basicConfig(filename="foo.log", handlers=[]) # type: ignore
|
||||
logging.basicConfig(filemode="w", handlers=[]) # type: ignore
|
||||
logging.basicConfig(stream=None, handlers=[]) # type: ignore
|
||||
logging.basicConfig(filename="foo.log", stream=None) # type: ignore
|
||||
logging.basicConfig(filename=None, stream=None) # type: ignore
|
||||
# These are ok.
|
||||
logging.basicConfig()
|
||||
logging.basicConfig(handlers=[])
|
||||
logging.basicConfig(filename="foo.log", filemode="w")
|
||||
logging.basicConfig(filename="foo.log", filemode="w", handlers=None)
|
||||
logging.basicConfig(stream=None)
|
||||
logging.basicConfig(stream=None, handlers=None)
|
||||
# dubious but accepted, has same meaning as 'stream=None'.
|
||||
logging.basicConfig(filename=None)
|
||||
# These are technically accepted at runtime, but are forbidden in the stubs to help
|
||||
# prevent user mistakes. Passing 'filemode' / 'encoding' / 'errors' does nothing
|
||||
# if 'filename' is not specified.
|
||||
logging.basicConfig(stream=None, filemode="w") # type: ignore
|
||||
logging.basicConfig(stream=None, encoding="utf-8") # type: ignore
|
||||
logging.basicConfig(stream=None, errors="strict") # type: ignore
|
||||
logging.basicConfig(handlers=[], encoding="utf-8") # type: ignore
|
||||
logging.basicConfig(handlers=[], errors="strict") # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user