Skip to content

Commit

Permalink
fix: logger config and env file loading (#4174)
Browse files Browse the repository at this point in the history
* fix: logger config and env file loading

* fix: mypy error assignment and arg-type
  • Loading branch information
italojohnny authored Oct 22, 2024
1 parent f0eb7b5 commit 48148f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/backend/base/langflow/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions src/backend/base/langflow/logging/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")

Expand Down

0 comments on commit 48148f0

Please sign in to comment.