math-piqa-backend / src /logging.py
stellaathena's picture
Initial commit: MATH & PIQA Backend
81afbdf verified
raw
history blame contribute delete
783 Bytes
"""Logging configuration for the backend."""
import logging
import os
from pathlib import Path
# Log file location
log_file = Path("evaluation.log")
def configure_root_logger():
"""Configure the root logger with file and console handlers."""
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[
logging.FileHandler(log_file),
logging.StreamHandler(),
],
)
def setup_logger(name: str) -> logging.Logger:
"""
Set up a logger with the given name.
Args:
name: Logger name (typically __name__)
Returns:
Configured logger
"""
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
return logger