Move logging setup out of __init__.py - #166
Open
nsheff wants to merge 1 commit into
Open
Conversation
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.
Importing bedboss used to configure logging as a side effect, and not just for itself.
__init__.pyran sixcoloredlogs.install()calls that attached handlers to pipestat, geniml, bbconf, pephubclient, and refgenconf, and setpropagate = Falseon each.bbuploader/__init__.pydid the same for itself. All of that happened on import, whether or not anything wanted it.The reason those calls existed was to label each line with the package it came from, using hardcoded tags like
[PIPESTAT]and[BBCONF]. logmuse 0.3.1 puts the logger name in the default format, so that label now comes for free and reports the real logger rather than a fixed string.So the setup moved into the Typer callback, which runs before any command, and configures the root logger once. Everything logs through one handler and identifies itself:
Root is used rather than the bedboss logger because bbuploader logs under the name
bbuploader, notbedboss.bbuploader, so it is a separate tree and would not otherwise be covered.This also fixes a bug in the old code. The refgenconf block installed its handler on
_LOGGER_PHCinstead of_LOGGER_REF_CONF, so refgenconf never got one and pephubclient got two. Any refgenconf line was being labelled[PEPHUBCLIENT].Also adds
--verbosity,--logdev, and--silent, and requires logmuse 0.3.1.