Spaces:
Running on Zero
Running on Zero
Download utils/logger.py from Hobysenny/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 555 Bytes
-
https://huggingface.co/spaces/Hobysenny/Final_Assignment_Template/resolve/main/utils/logger.py
- Command line
-
hf download hf://spaces/Hobysenny/Final_Assignment_Template/utils/logger.py
-
curl -L -o logger.py https://huggingface.co/spaces/Hobysenny/Final_Assignment_Template/resolve/main/utils/logger.py
555 Bytes
| import logging | |
| def get_logger(name: str = __name__) -> logging.Logger: | |
| """ | |
| Create and configure a logger instance for the given module or name. | |
| Args: | |
| name (str, optional): Name of the logger. Defaults to the module name. | |
| Returns: | |
| logging.Logger: Configured logger instance. | |
| """ | |
| logging.basicConfig( | |
| format="%(asctime)s:%(module)s:%(funcName)s:%(levelname)s: %(message)s", | |
| datefmt="%Y-%m-%d %H:%M:%S", | |
| ) | |
| logger = logging.getLogger(name) | |
| logger.setLevel(logging.INFO) | |
| return logger |