Spaces:
Runtime error
Runtime error
Download src/logging.py from stellaathena/math-piqa-backend: direct link, hf CLI and curl.
- Browser
- Download file 783 Bytes
-
https://huggingface.co/spaces/stellaathena/math-piqa-backend/resolve/main/src/logging.py
- Command line
-
hf download hf://spaces/stellaathena/math-piqa-backend/src/logging.py
-
curl -L -o logging.py https://huggingface.co/spaces/stellaathena/math-piqa-backend/resolve/main/src/logging.py
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 | |