Repository navigation
fix(logging): configure each stdlib logger once and leave its name and preset level alone - #358
Merged
Merged
Conversation
…d preset level alone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #356.
Closes #357.
Three fixes to
MemoryLoggerFactory.__call__, each test-first:get_logger()proxy, and every call attached anotherMemoryHandlerto the same stdlib logger, so lines repeated once per proxy created so far. The factory now keeps a dict of the loggers it configured and returns a known logger unchanged.LoggerFactory(ignore_frame_names=...), sostructlog.get_logger()is named after the caller's module instead oflite_bootstrap.instruments.logging_factory. The parameter is older than the structlog 21.3 floor.logging_log_levelis set only on a logger whose level is stillNOTSET.close_handlers()resets the levels it set back toNOTSET. Without that, a second bootstrap with a differentlogging_log_levelwould keep the first run's level, and a separate test covers this.Release-note line: a stdlib level a service set on a logger before bootstrap now takes effect for structlog calls on that logger. Before, it was silently overwritten with
logging_log_level, so such a service may see more (or fewer) lines on that logger after upgrading.Verified: the four new tests failed before the change, the full suite passes at 100% coverage,
just lintis clean, and both reproductions from the issues now print one line per call, the caller's module name, and the preset DEBUG line.