Commit 5361ced
gh-145238: Add native thread ID to logging record attributes
Add a `nativeThreadId` attribute to `LogRecord` that exposes the
OS-native thread ID via `threading.get_native_id()`. This is useful
for correlating log entries with system tools like htop, strace, and
perf that display native thread IDs.
The attribute can be used in format strings as `%(nativeThreadId)d`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 0156133 commit 5361ced
File tree
3 files changed
+14
-0
lines changed- Doc/library
- Lib/logging
- Misc/NEWS.d/next/Library
3 files changed
+14
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1062 | 1062 | | |
1063 | 1063 | | |
1064 | 1064 | | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
1065 | 1068 | | |
1066 | 1069 | | |
1067 | 1070 | | |
| |||
1075 | 1078 | | |
1076 | 1079 | | |
1077 | 1080 | | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1078 | 1084 | | |
1079 | 1085 | | |
1080 | 1086 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
353 | 357 | | |
354 | 358 | | |
355 | 359 | | |
| 360 | + | |
356 | 361 | | |
357 | 362 | | |
358 | 363 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments