fix: logger config and env file loading (#4174)

* fix: logger config and env file loading

* fix: mypy error assignment and arg-type
This commit is contained in:
Ítalo Johnny 2024-10-22 11:29:32 -03:00 committed by GitHub
commit 48148f0df6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View file

@ -149,13 +149,12 @@ def run(
),
) -> None:
"""Run Langflow."""
configure(log_level=log_level, log_file=log_file)
set_var_for_macos_issue()
if env_file:
load_dotenv(env_file, override=True)
logger.debug(f"Loading config from file: '{env_file}'")
configure(log_level=log_level, log_file=log_file)
logger.debug(f"Loading config from file: '{env_file}'" if env_file else "No env_file provided.")
set_var_for_macos_issue()
settings_service = get_settings_service()
frame = inspect.currentframe()

View file

@ -150,6 +150,10 @@ def configure(
if log_level is None:
log_level = "ERROR"
if log_file is None:
env_log_file = os.getenv("LANGFLOW_LOG_FILE", "")
log_file = Path(env_log_file) if env_log_file else None
if log_env is None:
log_env = os.getenv("LANGFLOW_LOG_ENV", "")