Remove import-time logging setup - #163
Merged
Merged
Conversation
CI installs ruff unpinned; 0.16 began formatting Python blocks inside markdown, so README started failing on every branch.
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.
pepdbagent used to configure logging as a side effect of being imported.
__init__.pycalledlogmuse.init_logger("pepdbagent")and thencoloredlogs.install(), so simply runningimport pepdbagentwould attach a handler and start coloring output.That is the wrong place for that decision. pepdbagent is a library with no command line of its own, so the application using it should decide how its logs look.
Worse,
init_loggersetspropagate = Falseon the logger. That disconnects pepdbagent from the normal logging chain, so an application that configures logging the usual way gets nothing from pepdbagent at all. The only way around it is to reach in and configure thepepdbagentlogger by name.That is exactly what pephub does today, in
pephub/main.py, where it sets its own level and[PEPDBAGENT]prefix. That still works after this change, so nothing needs to be updated in pephub. It just no longer has to fight the defaults.This PR deletes the setup block from
__init__.pyand dropslogmuseandcoloredlogsfrom the dependencies, since nothing else in the package used either one. Every module already gets its logger withlogging.getLogger(PKG_NAME), and nothing imported_LOGGERfrom the package root, so there is nothing else to change.This follows the guidance added in logmuse 0.3.0, which now also applies colors on its own when coloredlogs is installed. Similar cleanups are needed in geopephub, bedboss, bedhost, and pephubclient.