def setup_output_folder(save_dir: str, folder_only: bool = False):
    """Sets up and returns the output file where the logs will be placed
    based on the configuration passed. Usually "save_dir/logs/log_<timestamp>.txt".
    If env.log_dir is passed, logs will be directly saved in this folder.
    Args:
        folder_only (bool, optional): If folder should be returned and not the file.
            Defaults to False.
    Returns:
        str: folder or file path depending on folder_only flag
    """
    log_filename = "train_"
    log_filename += time.strftime("%Y_%m_%dT%H_%M_%S")
    log_filename += ".log"

    log_folder = os.path.join(save_dir, "logs")

    if not os.path.exists(log_folder):
        os.path.mkdirs(log_folder)

    if folder_only:
        return log_folder

    log_filename = os.path.join(log_folder, log_filename)

    return log_filename
Sets up and returns the output file where the logs will be placed
based on the configuration passed. Usually "save_dir/logs/log_<timestamp>.txt".
If env.log_dir is passed, logs will be directly saved in this folder.
Args:
folder_only (bool, optional): If folder should be returned and not the file.
Defaults to False.
Returns:
str: folder or file path depending on folder_only flag
videomamba/video_mm/utils/logger.py