Spaces:
Sleeping
Sleeping
Download utils/logging.py from ThunderingCondor702/UniFlow-Audio: direct link, hf CLI and curl.
- Browser
- Download file 583 Bytes
-
https://huggingface.co/spaces/ThunderingCondor702/UniFlow-Audio/resolve/main/utils/logging.py
- Command line
-
hf download hf://spaces/ThunderingCondor702/UniFlow-Audio/utils/logging.py
-
curl -L -o logging.py https://huggingface.co/spaces/ThunderingCondor702/UniFlow-Audio/resolve/main/utils/logging.py
583 Bytes
| from pathlib import Path | |
| from dataclasses import dataclass | |
| import logging | |
| class LoggingLogger: | |
| filename: str | Path | |
| level: str = "INFO" | |
| def create_instance(self, ): | |
| filename = self.filename.__str__() | |
| formatter = logging.Formatter("[%(asctime)s] - %(message)s") | |
| logger = logging.getLogger(__name__ + "." + filename) | |
| logger.setLevel(getattr(logging, self.level)) | |
| file_handler = logging.FileHandler(filename) | |
| file_handler.setFormatter(formatter) | |
| logger.addHandler(file_handler) | |
| return logger | |