"""
init-mater-project

Copyright (C) 2025 [Lauranne Sarribouette] <lauranne.sarribouette@univ-grenoble-alpes.fr>

SPDX-License-Identifier: LGPL-3.0-or-later
"""

from loguru import logger


def setup_logging(log_dir: str = "logs") -> None:
    """
    Configure logging with size-based rotation

    Args:
        log_dir: Directory for log files (default: "logs")
    """
    logger.remove()
    logger.add(
        f"{log_dir}/mater.log",
        rotation="10 MB",
        retention=10,
        level="DEBUG",
        format="{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {name}:{function}:{line} - {message}",
        backtrace=True,
        diagnose=True,
    )
    logger.debug("Logging initialized")
