import logging
from typing import Optional

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
    handlers=[logging.StreamHandler()],
)


def get_logger(name: Optional[str] = None, use_accelerate: bool = False):
    if use_accelerate:
        from accelerate.logging import get_logger
        return get_logger(name or __name__)
    
    return logging.getLogger(name)
