"""Logging utilities for MoltenFlow.

This module provides a centralized logging configuration for the MoltenFlow package.
"""

from __future__ import annotations
import logging


def get_logger(name: str = "moltenflow") -> logging.Logger:
    """Get or create a logger with standard formatting.

    Creates a logger with a stream handler and formatted output if one doesn't
    already exist. Subsequent calls with the same name return the existing logger.

    Args:
        name: Logger name (typically __name__ of the calling module).
              Defaults to "moltenflow" for the root logger.

    Returns:
        Configured Logger instance with INFO level and stream handler.
    """
    logger = logging.getLogger(name)
    if not logger.handlers:
        handler = logging.StreamHandler()
        fmt = logging.Formatter("[%(asctime)s] %(levelname)s - %(message)s")
        handler.setFormatter(fmt)
        logger.addHandler(handler)
        logger.setLevel(logging.INFO)
    return logger
