Skip to content
This repository was archived by the owner on Mar 10, 2024. It is now read-only.

Conversation

@shay-k
Copy link
Collaborator

@shay-k shay-k commented Mar 4, 2021

log level from env

@shay-k shay-k requested a review from zvikagart March 4, 2021 15:23
from .gui.static import media

logging.basicConfig(level=logging.INFO)
logLevel=logging.WARNING

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To preserve compatibility with upstream I recommend to keep the default log level as info and override with the env var in our system

logging.basicConfig(level=logging.INFO)
logLevel=logging.WARNING
if os.environ.get("LOG_LEVEL") is not None:
lvl = logging._nameToLevel.get(os.environ.get("LOG_LEVEL").upper())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using private fields is not recommended.
Two other approaches:
https://stackoverflow.com/a/60679407
https://stackoverflow.com/a/35689599

@shay-k shay-k merged commit a8bcaf2 into main Mar 7, 2021
@shay-k shay-k deleted the set_default_log_level_to_warning branch March 7, 2021 09:02
shay-k added a commit that referenced this pull request Mar 9, 2021
shay-k added a commit that referenced this pull request Mar 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants