Fix logging issues that can arise when importing flaml #1377
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.
Previously, FLAML would automatically set its own loglevel when imported, overriding any other logging settings that may previously have been set by users of the library. FLAML will now check whether a loglevel has been explicitly set before setting its own.
In addition, the
flaml.automl
warning is now emitted usingwarnings
rather thanlogging.warning
. This falls more in line with other FLAML submodules (e.g.flaml.ml
).Taken in conjunction, these two changes make it a lot easier for downstream users to suppress warnings emitted by FLAML upon importing the library, either by configuring logging prior to importing
flaml
or by using the somewhat more idiomaticThis change also helps to ensure that FLAML's defaults won't override users' explicit logging settings.
Why are these changes needed?
These changes make it easier for downstream users to configure FLAML's logging utilities as they see fit, and make it easier to suppress certain warnings that may occur when importing
flaml
for the first time.Related issue number
N/A
Checks