Spaces:
Sleeping
Sleeping
Download logging_config.py from tbels89/Prometheus: direct link, hf CLI and curl.
- Browser
- Download file 646 Bytes
-
https://huggingface.co/spaces/tbels89/Prometheus/resolve/main/logging_config.py
- Command line
-
hf download hf://spaces/tbels89/Prometheus/logging_config.py
-
curl -L -o logging_config.py https://huggingface.co/spaces/tbels89/Prometheus/resolve/main/logging_config.py
646 Bytes
| # logging_config.py | |
| import logging | |
| from logging.handlers import RotatingFileHandler | |
| import os | |
| LOG_FILE_PATH = "./logs/app.log" | |
| if not os.path.exists(LOG_FILE_PATH): | |
| with open(LOG_FILE_PATH, 'w') as log_file: | |
| log_file.write("") # Create an empty file | |
| # Setup logging | |
| logging.basicConfig( | |
| level=logging.INFO, | |
| format='%(asctime)s %(levelname)s:%(name)s:%(funcName)s:%(message)s', | |
| handlers=[ | |
| RotatingFileHandler(LOG_FILE_PATH, maxBytes=5*1024*1024, backupCount=3), | |
| logging.StreamHandler() | |
| ] | |
| ) | |
| logger = logging.getLogger(__name__) | |
| # Test logging | |
| logger.info("Logging setup initialized successfully.") | |