Spaces:
Sleeping
Sleeping
Download src/utils/utils.py from logan-codes/telco-churn-predictor: direct link, hf CLI and curl.
- Browser
- Download file 558 Bytes
-
https://huggingface.co/spaces/logan-codes/telco-churn-predictor/resolve/main/src/utils/utils.py
- Command line
-
hf download hf://spaces/logan-codes/telco-churn-predictor/src/utils/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/logan-codes/telco-churn-predictor/resolve/main/src/utils/utils.py
558 Bytes
| import logging | |
| def setup_logger(name: str, log_file: str, level=logging.INFO): | |
| """ | |
| Creates and configures a logger. | |
| Args: | |
| name (str): Logger name. | |
| log_file (str): File to log to. | |
| level: Logging level. | |
| """ | |
| handler = logging.FileHandler(log_file) | |
| formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') | |
| handler.setFormatter(formatter) | |
| logger = logging.getLogger(name) | |
| logger.setLevel(level) | |
| logger.addHandler(handler) | |
| return logger |