main commit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-16 16:30:25 +09:00
parent 91c7e04474
commit 537e7b363f
1146 changed files with 45926 additions and 77196 deletions

View File

@@ -17,7 +17,6 @@ from contextlib import contextmanager
from typing import Any, Generator, NamedTuple, NoReturn
from ._config import configure, get_config
from ._log_levels import map_method_name
from .exceptions import DropEvent
from .typing import EventDict, WrappedLogger
@@ -42,10 +41,6 @@ class LogCapture:
:ivar List[structlog.typing.EventDict] entries: The captured log entries.
.. versionadded:: 20.1.0
.. versionchanged:: 24.3.0
Added mapping from "exception" to "error"
Added mapping from "warn" to "warning"
"""
entries: list[EventDict]
@@ -56,7 +51,7 @@ class LogCapture:
def __call__(
self, _: WrappedLogger, method_name: str, event_dict: EventDict
) -> NoReturn:
event_dict["log_level"] = map_method_name(method_name)
event_dict["log_level"] = method_name
self.entries.append(event_dict)
raise DropEvent
@@ -144,7 +139,8 @@ class CapturedCall(NamedTuple):
Can also be unpacked like a tuple.
Args:
Arguments:
method_name: The method name that got called.
args: A tuple of the positional arguments.
@@ -177,7 +173,7 @@ class CapturingLogger:
self.calls = []
def __repr__(self) -> str:
return f"<CapturingLogger with {len(self.calls)} call(s)>"
return f"<CapturingLogger with { len(self.calls) } call(s)>"
def __getattr__(self, name: str) -> Any:
"""
@@ -194,7 +190,7 @@ class CapturingLoggerFactory:
r"""
Produce and cache `CapturingLogger`\ s.
Each factory produces and reuses only **one** logger.
Each factory produces and re-uses only **one** logger.
You can access it via the ``logger`` attribute.
@@ -204,7 +200,6 @@ class CapturingLoggerFactory:
.. versionadded:: 20.2.0
"""
logger: CapturingLogger
def __init__(self) -> None: