Fix InternalLogger to properly register with logging hierarchy #127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
InternalLoggerinstances were not being registered with Python's logging manager, causing several issues:parent = Nonelogging.basicConfig()and parent logger handlers had no effectExample of the issue:
Solution
This PR fixes the issue by properly integrating
InternalLoggerwith Python's logging system:1. Register with logging manager (lines 72-94)
logging.Logger.manager.loggerDict_fixupParents)2. Fix
prefab_internalattribute injection (lines 96-126)log()to overriding_log()info(),debug(), etc. call_log()directly, notlog()prefab_internal=Trueto theextradict on all log recordsCompatibility
✅ Standard logging: Works with
basicConfig()and manual handler configuration✅ Structlog: Works when structlog is configured to use stdlib logging
✅ Maintains
prefab_internalattribute: Still adds the extra attribute to identify Prefab's internal logsTesting
Tested with both standard logging and structlog:
Impact
This fix allows users to see important Prefab internal logs such as:
Previously, these logs were invisible unless users manually configured handlers for Prefab's loggers.
🤖 Generated with Claude Code