Skip to content

Commit

Permalink
vdk-core: remove structlog logging override (#3066)
Browse files Browse the repository at this point in the history
## Why?

Structlog should not override the initial logging config. It applies to
logging before vdk is initialized and before any plugins are loaded. If
an error happens in vdk_main, the logging config will apply. It should
remain in core.

It's also not a problem for structlog, because it ejects all logging
config just in case.

## What?

Remove the structlog override in core

## How was this tested?

Locally
CI

## What kind of change is this?

Bugfix

Signed-off-by: Dilyan Marinov <[email protected]>
Co-authored-by: Dilyan Marinov <[email protected]>
  • Loading branch information
DeltaMichael and Dilyan Marinov authored Feb 1, 2024
1 parent 5d620e5 commit 6ba82d4
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,13 @@ def configure_initial_logging_before_anything():
# warnings.warn(
# "The vdk-core logging configuration is not suitable for production. Please use vdk-structlog instead."
# )
if not os.environ.get("VDK_USE_STRUCTLOG"):
log_level = "WARNING"
if os.environ.get(LOG_LEVEL_VDK, None):
log_level = os.environ.get(LOG_LEVEL_VDK)
elif os.environ.get("VDK_LOG_LEVEL_VDK", None):
log_level = os.environ.get("VDK_LOG_LEVEL_VDK")

logging.basicConfig(format="%(message)s", level=logging.getLevelName(log_level))
log_level = "WARNING"
if os.environ.get(LOG_LEVEL_VDK, None):
log_level = os.environ.get(LOG_LEVEL_VDK)
elif os.environ.get("VDK_LOG_LEVEL_VDK", None):
log_level = os.environ.get("VDK_LOG_LEVEL_VDK")

logging.basicConfig(format="%(message)s", level=logging.getLevelName(log_level))


def configure_loggers(
Expand Down

0 comments on commit 6ba82d4

Please sign in to comment.