mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
allow string levels in logging (#1234)
* allow string levels in logging * remove redundant Union member
This commit is contained in:
committed by
Matthias Kramm
parent
8d8a34cb83
commit
8d1114c0c3
@@ -18,6 +18,7 @@ else:
|
||||
_ExcInfoType = Union[None, bool, _SysExcInfoType]
|
||||
_ArgsType = Union[Tuple[Any, ...], Dict[str, Any]]
|
||||
_FilterType = Union['Filter', Callable[['LogRecord'], int]]
|
||||
_Level = Union[int, Text]
|
||||
|
||||
|
||||
class Logger:
|
||||
@@ -130,7 +131,7 @@ class Handler(Filterer):
|
||||
level = ... # type: int
|
||||
formatter = ... # type: Optional[Formatter]
|
||||
lock = ... # type: Optional[threading.Lock]
|
||||
def __init__(self, level: int = ...) -> None: ...
|
||||
def __init__(self, level: _Level = ...) -> None: ...
|
||||
def createLock(self) -> None: ...
|
||||
def acquire(self) -> None: ...
|
||||
def release(self) -> None: ...
|
||||
@@ -332,7 +333,7 @@ def makeLogRecord(attrdict: Mapping[str, Any]) -> LogRecord: ...
|
||||
if sys.version_info >= (3,):
|
||||
def basicConfig(*, filename: str = ..., filemode: str = ...,
|
||||
format: str = ..., datefmt: str = ..., style: str = ...,
|
||||
level: int = ..., stream: IO[str] = ...,
|
||||
level: _Level = ..., stream: IO[str] = ...,
|
||||
handlers: Iterable[Handler] = ...) -> None: ...
|
||||
else:
|
||||
@overload
|
||||
@@ -340,7 +341,7 @@ else:
|
||||
@overload
|
||||
def basicConfig(*, filename: str = ..., filemode: str = ...,
|
||||
format: str = ..., datefmt: str = ...,
|
||||
level: int = ..., stream: IO[str] = ...) -> None: ...
|
||||
level: _Level = ..., stream: IO[str] = ...) -> None: ...
|
||||
def shutdown() -> None: ...
|
||||
|
||||
def setLoggerClass(klass: type) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user