Commit 21189c7
fix: format traceback inline for loguru compatibility (#622)
Stop passing `exc_info=` as a kwarg to `logger.log()`. Standard
`logging.Logger` treats this specially (appends traceback), but loguru
interprets all kwargs as message format parameters, causing a KeyError.
Instead, format the traceback into the message string directly using
`traceback.format_exception()`. This works with all loggers that
implement `LoggerProtocol` (logging, loguru, structlog, etc.).
Also tighten `LoggerProtocol.log()` by removing `**kwargs` since we
no longer pass any keyword arguments.
Fixes #420
Change-Id: Icc145539d443c83f09266e25b9819bd2516aeddc
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent e104116 commit 21189c7
2 files changed
Lines changed: 12 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
| 35 | + | |
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
39 | | - | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| |||
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 48 | | |
55 | 49 | | |
56 | | - | |
57 | 50 | | |
58 | 51 | | |
59 | 52 | | |
60 | | - | |
61 | | - | |
| 53 | + | |
62 | 54 | | |
63 | | - | |
64 | | - | |
| 55 | + | |
65 | 56 | | |
66 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
67 | 66 | | |
0 commit comments