Skip to content

Commit 9fd61a8

Browse files
committed
Support defaults parameter, added in Python 3.10
Resolves #123.
1 parent 250a692 commit 9fd61a8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

colorlog/formatter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ def __init__(
6868
stream: typing.Optional[typing.IO] = None,
6969
no_color: bool = False,
7070
force_color: bool = False,
71+
defaults: typing.Optional[typing.Mapping[str, typing.Any]] = None,
7172
) -> None:
7273
"""
7374
Set the format and colors the ColoredFormatter will use.
7475
75-
The ``fmt``, ``datefmt`` and ``style`` args are passed on to the
76+
The ``fmt``, ``datefmt``, ``style``, and ``default`` args are passed on to the
7677
``logging.Formatter`` constructor.
7778
7879
The ``secondary_log_colors`` argument can be used to create additional
@@ -105,7 +106,9 @@ def __init__(
105106
# Select a default format if `fmt` is not provided.
106107
fmt = default_formats[style] if fmt is None else fmt
107108

108-
if sys.version_info >= (3, 8):
109+
if sys.version_info >= (3, 10):
110+
super().__init__(fmt, datefmt, style, validate, defaults=defaults)
111+
elif sys.version_info >= (3, 8):
109112
super().__init__(fmt, datefmt, style, validate)
110113
else:
111114
super().__init__(fmt, datefmt, style)

0 commit comments

Comments
 (0)