Spaces:
Sleeping
Sleeping
Download core/logging_utils.py from Coeinterns/bank-statement-api: direct link, hf CLI and curl.
- Browser
- Download file 498 Bytes
-
https://huggingface.co/spaces/Coeinterns/bank-statement-api/resolve/main/core/logging_utils.py
- Command line
-
hf download hf://spaces/Coeinterns/bank-statement-api/core/logging_utils.py
-
curl -L -o logging_utils.py https://huggingface.co/spaces/Coeinterns/bank-statement-api/resolve/main/core/logging_utils.py
498 Bytes
| import logging | |
| from pathlib import Path | |
| _swap_log_dir = Path("logs") | |
| _swap_log_dir.mkdir(exist_ok=True) | |
| class _SwapLog: | |
| """Simple file writer that flushes every line.""" | |
| def debug(self, msg, statement_id=None): | |
| if statement_id: | |
| path = _swap_log_dir / f"auto_swap_{statement_id}.log" | |
| else: | |
| path = _swap_log_dir / "auto_swap_general.log" | |
| with open(path, "a", encoding="utf-8") as f: | |
| f.write(msg + "\n") | |
| _swap_logger = _SwapLog() | |