Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note to structlog docs #116

Merged

Conversation

will-ockmore
Copy link
Contributor

Make it clear that the cache_logger_on_first_use parameter should not be set during tests.

@etianen etianen merged commit 77995f5 into etianen:main Feb 17, 2024
16 checks passed
@etianen
Copy link
Owner

etianen commented Feb 17, 2024

I wonder, can we disable the cache during log capture by some structlog method call?

@will-ockmore
Copy link
Contributor Author

We could (with the configure call in start_capturing). This wouldn't affect any previously cached loggers; there's no way to reconfigure them once initialised without access to the instance.

See the second point on https://www.structlog.org/en/stable/performance.html for a more detailed explanation of the mechanism.

It would be down to the user to ensure no loggers are cached at any stage; even if we set a global hook they could always call configure again with cache_logger_on_first_use and then initialise a logger somewhere

@etianen
Copy link
Owner

etianen commented Feb 17, 2024

Ah, and even the testing docs for `structlog' say the same thing: turn off this in testing!

@etianen etianen added the documentation Improvements or additions to documentation label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants