diff options
Diffstat (limited to 'openbb_platform/core/openbb_core/app/logs/utils/utils.py')
-rw-r--r-- | openbb_platform/core/openbb_core/app/logs/utils/utils.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/openbb_platform/core/openbb_core/app/logs/utils/utils.py b/openbb_platform/core/openbb_core/app/logs/utils/utils.py index a94efd331cb..e150627b147 100644 --- a/openbb_platform/core/openbb_core/app/logs/utils/utils.py +++ b/openbb_platform/core/openbb_core/app/logs/utils/utils.py @@ -1,12 +1,10 @@ -# IMPORT STANDARD +"""Utility functions for logging.""" + import time import uuid import warnings from pathlib import Path, PosixPath -# IMPORT THIRD-PARTY -# IMPORT INTERNAL - def get_session_id() -> str: """UUID of the current session.""" @@ -41,6 +39,7 @@ def get_log_dir(contextual_user_data_directory: str) -> PosixPath: def create_log_dir_if_not_exists(contextual_user_data_directory: str) -> Path: + """Create a log directory for the current installation.""" log_dir = Path(contextual_user_data_directory).joinpath("logs").absolute() if not log_dir.is_dir(): log_dir.mkdir(parents=True, exist_ok=True) @@ -49,6 +48,7 @@ def create_log_dir_if_not_exists(contextual_user_data_directory: str) -> Path: def create_log_uuid_if_not_exists(log_dir: Path) -> str: + """Create a log id file for the current logging session.""" log_id = get_log_id(log_dir) if not log_id.is_file(): logging_id = f"{uuid.uuid4()}" @@ -60,10 +60,12 @@ def create_log_uuid_if_not_exists(log_dir: Path) -> str: def get_log_id(log_dir): + """Get the log id file.""" return (log_dir / ".logid").absolute() def create_uuid_dir_if_not_exists(log_dir, logging_id) -> PosixPath: + """Create a directory for the current logging session.""" uuid_log_dir = (log_dir / logging_id).absolute() if not uuid_log_dir.is_dir(): |