Skip to content

Commit f23783a

Browse files
committed
Fix logging.Formatter for py2.7
1 parent 14a1636 commit f23783a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ecs_logging/_stdlib.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,14 @@ def __init__(
103103
if validate is not None:
104104
# validate was introduced in py3.8 so we need to only provide it if the user provided it
105105
_kwargs["validate"] = validate
106-
super(StdlibFormatter, self).__init__( # type: ignore[call-arg]
107-
fmt=fmt, datefmt=datefmt, style=style, **_kwargs
108-
)
106+
if sys.version_info < (3, 0): # Different args in py2.7
107+
super(StdlibFormatter, self).__init__( # type: ignore[call-arg]
108+
fmt=fmt, datefmt=datefmt
109+
)
110+
else:
111+
super(StdlibFormatter, self).__init__( # type: ignore[call-arg]
112+
fmt=fmt, datefmt=datefmt, style=style, **_kwargs
113+
)
109114

110115
if stack_trace_limit is not None:
111116
if not isinstance(stack_trace_limit, int):

0 commit comments

Comments
 (0)