Skip to content

Commit

Permalink
fix: 3.10 logging.LoggerAdapter not subscriptable
Browse files Browse the repository at this point in the history
  • Loading branch information
jykob committed Oct 28, 2024
1 parent d95d568 commit 00a9f19
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tsbot/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

import logging
from collections.abc import MutableMapping
from typing import Any, TypedDict, cast
from typing import TYPE_CHECKING, Any, TypedDict, cast

if TYPE_CHECKING:
_LoggerAdapter = logging.LoggerAdapter[logging.Logger]
else:
_LoggerAdapter = logging.LoggerAdapter


_logger = logging.getLogger(__package__ or "tsbot")

Expand All @@ -11,7 +17,7 @@ class LoggerExtra(TypedDict):
from_module: str


class TSBotLogger(logging.LoggerAdapter[logging.Logger]):
class TSBotLogger(_LoggerAdapter):
_debug: bool = False

def __init__(self, logger: logging.Logger, extra: LoggerExtra) -> None:
Expand Down

0 comments on commit 00a9f19

Please sign in to comment.