Skip to content

Commit fd390b6

Browse files
committed
fix(logging[doctest]): add doctest to TmuxpLoggerAdapter
why: CLAUDE.md requires all functions and methods to have working doctests. what: - Add Examples section to TmuxpLoggerAdapter demonstrating extra merging
1 parent ad99470 commit fd390b6

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/tmuxp/log.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ class TmuxpLoggerAdapter(logging.LoggerAdapter): # type: ignore[type-arg]
3030
3131
Follows the portable pattern to avoid repeating the same `extra` on every call
3232
while preserving the ability to add per-call `extra` kwargs.
33+
34+
Examples
35+
--------
36+
>>> adapter = TmuxpLoggerAdapter(
37+
... logging.getLogger("test"),
38+
... {"tmux_session": "my-session"},
39+
... )
40+
>>> msg, kwargs = adapter.process("hello %s", {"extra": {"tmux_window": "editor"}})
41+
>>> msg
42+
'hello %s'
43+
>>> kwargs["extra"]["tmux_session"]
44+
'my-session'
45+
>>> kwargs["extra"]["tmux_window"]
46+
'editor'
3347
"""
3448

3549
def process(

0 commit comments

Comments
 (0)