Commit 66388d2
committed
Dispatch warn level to logging.warning, not deprecated .warn (#89)
On the asyncio backend, _log() did `getattr(logger._logger, level)(msg)`
with level == "warn", which resolves to logging.Logger.warn — the
deprecated alias of .warning — emitting "DeprecationWarning: The 'warn'
method is deprecated, use 'warning' instead".
Remap the "warn" level name to "warning" for stdlib dispatch, mirroring
the existing "trace" -> "debug" handling, while keeping the txaio-facing
level name "warn" in kwargs["log_level"]. The Twisted backend is
unaffected (it maps to LogLevel.warn, not stdlib method names).
Add a cross-backend regression test (test_warn) that turns
DeprecationWarning into an error and asserts the message is emitted.
Verified red before the fix (asyncio) and green after, both backends.
Note: This work was completed with AI assistance (Claude Code).1 parent 53eb204 commit 66388d2
3 files changed
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
165 | 169 | | |
166 | 170 | | |
167 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
142 | 164 | | |
143 | 165 | | |
144 | 166 | | |
| |||
0 commit comments