Commit 3f2bc95
Fix InternalLogger to properly register with logging hierarchy
InternalLogger instances were not being registered with Python's logging
manager, causing them to have no parent logger and preventing handler
propagation. This meant that:
- basicConfig() had no effect on InternalLogger instances
- They couldn't inherit handlers from parent loggers
- Users couldn't see Prefab's internal logs without manual configuration
This commit fixes the issue by:
1. Registering InternalLogger instances with logging.Logger.manager.loggerDict
during __init__, ensuring they participate in the logging hierarchy
2. Setting up parent loggers properly (adapted from Python's logging
internals) so handlers propagate correctly
3. Fixing the prefab_internal extra attribute by overriding _log() instead
of log(), since info(), debug(), etc. call _log() directly
The fix is compatible with both:
- Standard logging (logging.basicConfig, manual handler configuration)
- Structlog (when configured to use stdlib logging)
The prefab_internal=True extra attribute is still added to all log records
from InternalLogger instances, allowing users to filter/identify Prefab's
internal messages.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 14b242a commit 3f2bc95
1 file changed
+54
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
73 | 110 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
0 commit comments