Spaces:
Running
Running
Download logger.py from sitammeur/Qwen-Coder-llamacpp: direct link, hf CLI and curl.
- Browser
- Download file 671 Bytes
-
https://huggingface.co/spaces/sitammeur/Qwen-Coder-llamacpp/resolve/main/logger.py
- Command line
-
hf download hf://spaces/sitammeur/Qwen-Coder-llamacpp/logger.py
-
curl -L -o logger.py https://huggingface.co/spaces/sitammeur/Qwen-Coder-llamacpp/resolve/main/logger.py
671 Bytes
| # Importing the required modules | |
| import os | |
| import logging | |
| from datetime import datetime | |
| # Creating a log file with the current date and time as the name of the file | |
| LOG_FILE = f"{datetime.now().strftime('%m_%d_%Y_%H_%M_%S')}.log" | |
| # Creating a logs folder if it does not exist | |
| logs_path = os.path.join(os.getcwd(), "logs", LOG_FILE) | |
| os.makedirs(logs_path, exist_ok=True) | |
| # Setting the log file path and the log level | |
| LOG_FILE_PATH = os.path.join(logs_path, LOG_FILE) | |
| # Configuring the logger | |
| logging.basicConfig( | |
| filename=LOG_FILE_PATH, | |
| format="[ %(asctime)s ] %(lineno)d %(name)s - %(levelname)s - %(message)s", | |
| level=logging.INFO, | |
| ) | |