set global loglevel for subprocesses (#4791)

This commit is contained in:
Thomas Brandého 2025-02-11 21:15:38 +01:00 committed by GitHub
parent 372bd22475
commit 64b1630d02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,7 @@ from __future__ import annotations
import contextlib
import inspect
import os
import shutil
import time
from pathlib import Path
@ -60,6 +61,9 @@ def set_log_level(log_level: LogLevel):
f"log_level must be a LogLevel enum value, got {log_level} of type {type(log_level)} instead."
)
global _LOG_LEVEL
if log_level != _LOG_LEVEL:
# Set the loglevel persistenly for subprocesses.
os.environ["LOGLEVEL"] = log_level.value
_LOG_LEVEL = log_level