Skip to content

Logging Tweaks#113

Open
millercommamatt wants to merge 6 commits into
LJMUAstroecology:mainfrom
millercommamatt:main
Open

Logging Tweaks#113
millercommamatt wants to merge 6 commits into
LJMUAstroecology:mainfrom
millercommamatt:main

Conversation

@millercommamatt

Copy link
Copy Markdown

This PR is to fix what i think is an unintended bug for logging. In using flirpy in my code, I noticed that my logs were full of INFO level entries from flirpy despite the default logging level being WARNING. The reason for this is that in my code, I had already run logging.basicConfig() and specified a logging level of INFO. logging.basicConfig() doesn't do anything if the logging object already has handlers. So, the log level setting for flirpy was being ignored. This PR makes it so that the setLevel method is used when the logger already has handlers from basicConfig being run. Otherwise, basicConfig is run.

swapped `logger.basicConfig` for `logger.setLevel`
Swapped logging.basicConfig with setlevel
swapped logging.basicConfig with setLevel
changed to use setLevel only if basicConfig hadn't already be run
set to only use setLevel is basicConfig hadn't been run yet
only use setLevel if logger already has a handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant