Skip to content

main_error

main_error

get_first_log_path

get_first_log_path(log_dir: str) -> str

Return the full path to the first regular file inside the directory.

Source code in source/src/main_error.py
def get_first_log_path(log_dir: str) -> str:
    """Return the full path to the first regular file inside the directory."""
    if not os.path.isdir(log_dir):
        raise ValueError(f"'{log_dir}' is not a valid directory")

    for entry in os.listdir(log_dir):
        full_path = os.path.join(log_dir, entry)
        if os.path.isfile(full_path):
            return full_path

    raise FileNotFoundError(f"No files found in directory: {log_dir}")