Fix handling of logging args (#2635)

* Use _ArgsType for logging.makeRecord
* The "args" argument is passed to LogMessage, so passing a tuple in is fine as
well.
* Use Mapping rather than Dict, see https://bugs.python.org/issue21172
This commit is contained in:
Florian Bruhin
2018-11-29 12:56:01 +01:00
committed by Sebastian Rittau
parent 388de0876b
commit f2e842b2d9

View File

@@ -16,7 +16,7 @@ if sys.version_info >= (3, 5):
_ExcInfoType = Union[None, bool, _SysExcInfoType, BaseException]
else:
_ExcInfoType = Union[None, bool, _SysExcInfoType]
_ArgsType = Union[Tuple[Any, ...], Dict[str, Any]]
_ArgsType = Union[Tuple[Any, ...], Mapping[str, Any]]
_FilterType = Union[Filter, Callable[[LogRecord], int]]
_Level = Union[int, Text]
if sys.version_info >= (3, 6):
@@ -114,7 +114,7 @@ class Logger(Filterer):
def handle(self, record: LogRecord) -> None: ...
if sys.version_info >= (3,):
def makeRecord(self, name: str, lvl: int, fn: str, lno: int, msg: Any,
args: Mapping[str, Any],
args: _ArgsType,
exc_info: Optional[_SysExcInfoType],
func: Optional[str] = ...,
extra: Optional[Mapping[str, Any]] = ...,
@@ -122,7 +122,7 @@ class Logger(Filterer):
else:
def makeRecord(self,
name: str, lvl: int, fn: str, lno: int, msg: Any,
args: Mapping[str, Any],
args: _ArgsType,
exc_info: Optional[_SysExcInfoType],
func: Optional[str] = ...,
extra: Optional[Mapping[str, Any]] = ...) -> LogRecord: ...