Skip to content

Commit e105b4c

Browse files
committed
Fix mypy for validate arg (only py3.8+)
1 parent 0c543f1 commit e105b4c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ecs_logging/_stdlib.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ def __init__(
7676
fmt=None,
7777
datefmt=None,
7878
style="%",
79-
validate=True,
79+
validate=None,
8080
stack_trace_limit=None,
8181
exclude_fields=(),
8282
):
83-
# type: (Any, Optional[str], Optional[str], str, bool, Optional[int], Sequence[str]) -> None
83+
# type: (Any, Optional[str], Optional[str], str, Optional[bool], Optional[int], Sequence[str]) -> None
8484
"""Initialize the ECS formatter.
8585
8686
:param int stack_trace_limit:
@@ -99,8 +99,11 @@ def __init__(
9999
100100
exclude_keys=["error"]
101101
"""
102+
_kwargs = {}
103+
if validate is not None:
104+
_kwargs["validate"] = validate
102105
super(StdlibFormatter, self).__init__(
103-
fmt=fmt, datefmt=datefmt, style=style, validate=validate
106+
fmt=fmt, datefmt=datefmt, style=style, **_kwargs
104107
)
105108

106109
if stack_trace_limit is not None:

0 commit comments

Comments
 (0)