Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/structlog/_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ class BytesLogger:

__slots__ = ("_file", "_flush", "_lock", "_write", "name")

name: str | None

def __init__(
self, file: BinaryIO | None = None, *, name: str | None = None
):
Expand Down
15 changes: 15 additions & 0 deletions src/structlog/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class LogfmtRenderer:
.. versionadded:: 21.5.0
"""

bool_as_flag: bool

def __init__(
self,
sort_keys: bool = False,
Expand Down Expand Up @@ -404,6 +406,8 @@ class ExceptionRenderer:
.. versionadded:: 22.1.0
"""

format_exception: ExceptionTransformer

def __init__(
self,
exception_formatter: ExceptionTransformer = _format_exception,
Expand Down Expand Up @@ -478,6 +482,10 @@ class TimeStamper:

__slots__ = ("_stamper", "fmt", "key", "utc")

fmt: str | None
utc: bool
key: str

def __init__(
self,
fmt: str | None = None,
Expand Down Expand Up @@ -580,6 +588,8 @@ class MaybeTimeStamper:

__slots__ = ("stamper",)

stamper: TimeStamper

def __init__(
self,
fmt: str | None = None,
Expand Down Expand Up @@ -654,6 +664,8 @@ class ExceptionPrettyPrinter:
Fixed *exception_formatter* so that it overrides the default if set.
"""

format_exception: ExceptionTransformer

def __init__(
self,
file: TextIO | None = None,
Expand Down Expand Up @@ -971,6 +983,9 @@ class EventRenamer:
See also the :ref:`rename-event` recipe.
"""

to: str
replace_by: str | None

def __init__(self, to: str, replace_by: str | None = None):
self.to = to
self.replace_by = replace_by
Expand Down
11 changes: 10 additions & 1 deletion src/structlog/stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,8 @@ class PositionalArgumentsFormatter:
removed from the event dict after formatting a message.
"""

remove_positional_args: bool

def __init__(self, remove_positional_args: bool = True) -> None:
self.remove_positional_args = remove_positional_args

Expand Down Expand Up @@ -1094,6 +1096,14 @@ class ProcessorFormatter(logging.Formatter):
.. versionadded:: 23.3.0 *use_get_message*
"""

processors: Sequence[Processor]
foreign_pre_chain: Sequence[Processor] | None
keep_exc_info: bool
keep_stack_info: bool
logger: logging.Logger | None
pass_foreign_args: bool
use_get_message: bool

def __init__(
self,
processor: Processor | None = None,
Expand All @@ -1117,7 +1127,6 @@ def __init__(
)
raise TypeError(msg)

self.processors: Sequence[Processor]
if processor is not None:
self.processors = (self.remove_processors_meta, processor)
elif processors:
Expand Down
11 changes: 10 additions & 1 deletion src/structlog/tracebacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,15 @@ class ExceptionDictTransformer:
Handle exception groups.
"""

show_locals: bool
locals_max_length: int
locals_max_string: int
locals_hide_dunder: bool
locals_hide_sunder: bool
suppress: Sequence[str]
max_frames: int
use_rich: bool

def __init__(
self,
*,
Expand All @@ -450,7 +459,7 @@ def __init__(
self.locals_max_string = locals_max_string
self.locals_hide_dunder = locals_hide_dunder
self.locals_hide_sunder = locals_hide_sunder
self.suppress: Sequence[str] = []
self.suppress = []
for suppress_entity in suppress:
if not isinstance(suppress_entity, str):
if suppress_entity.__file__ is None:
Expand Down
2 changes: 2 additions & 0 deletions src/structlog/twisted.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class ReprWrapper:
Note the extra quotes in the unwrapped example.
"""

string: str

def __init__(self, string: str) -> None:
self.string = string

Expand Down