Skip to content

Commit d810f5e

Browse files
committed
Add type hinting to fields parameter
1 parent 616887f commit d810f5e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

logging_json/_formatter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import collections
22
import json
33
import logging
4-
from typing import Any
4+
from typing import Any, Dict
55

66
standard_attributes = (
77
"name",
@@ -29,7 +29,7 @@
2929
)
3030

3131

32-
def _extra_attributes(record: logging.LogRecord) -> dict[str, Any]:
32+
def _extra_attributes(record: logging.LogRecord) -> Dict[str, Any]:
3333
return {
3434
name: record.__dict__[name]
3535
for name in set(record.__dict__).difference(standard_attributes)
@@ -49,7 +49,7 @@ def _value(record: logging.LogRecord, field_name_or_value: Any) -> Any:
4949

5050

5151
class JSONFormatter(logging.Formatter):
52-
def __init__(self, *args, fields=None, **kwargs):
52+
def __init__(self, *args, fields: Dict[str, Any] = None, **kwargs):
5353
# Allow to provide any formatter setting (useful to provide a custom date format)
5454
super().__init__(*args, **kwargs)
5555
self.fields = fields or {}

0 commit comments

Comments
 (0)