Skip to content

Commit

Permalink
feat: set required python version to >=3.8,<4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hhk7734 committed Nov 12, 2023
1 parent f406707 commit d4c7710
Show file tree
Hide file tree
Showing 5 changed files with 413 additions and 459 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python 3.10.12
python 3.8.18
20 changes: 10 additions & 10 deletions loggingx/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
from contextvars import ContextVar
from logging import LogRecord
from types import TracebackType
from typing import Any, Generator, Mapping, TypeAlias
from typing import Any, Dict, Generator, Mapping, Optional, Tuple, Type, Union

_SysExcInfoType: TypeAlias = (
tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None]
)
_ArgsType: TypeAlias = tuple[object, ...] | Mapping[str, object]
_SysExcInfoType = Union[
Tuple[Type[BaseException], BaseException, Optional[TracebackType]], Tuple[None, None, None]
]
_ArgsType = Union[Tuple[object, ...], Mapping[str, object]]


_ctx = ContextVar[dict[str, Any]]("loggingxCtx", default={})
_ctx = ContextVar[Dict[str, Any]]("loggingxCtx", default={})


@contextmanager
Expand All @@ -32,10 +32,10 @@ def __init__(
pathname: str,
lineno: int,
msg: object,
args: _ArgsType | None,
exc_info: _SysExcInfoType | None,
func: str | None = None,
sinfo: str | None = None,
args: Optional[_ArgsType],
exc_info: Optional[_SysExcInfoType],
func: Optional[str] = None,
sinfo: Optional[str] = None,
**kwargs,
):
super().__init__(
Expand Down
3 changes: 2 additions & 1 deletion loggingx/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
from enum import Enum
from logging import Formatter
from typing import List, Union

from loggingx.context import CtxRecord

Expand Down Expand Up @@ -51,7 +52,7 @@ class Information(str, Enum):
class JSONFormatter(Formatter):
def __init__(
self,
additional_infos: Information | list[Information] | None = None,
additional_infos: Union[Information, List[Information], None] = None,
) -> None:
super().__init__()
if additional_infos is None:
Expand Down
Loading

0 comments on commit d4c7710

Please sign in to comment.