Fix build: Bundle schwab_scraper source and use local dependencies
All checks were successful
Build and Push Docker Image / build (push) Successful in 34s
All checks were successful
Build and Push Docker Image / build (push) Successful in 34s
This commit is contained in:
19
schwab_scraper/utils/logging.py
Normal file
19
schwab_scraper/utils/logging.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import logging
|
||||
import os
|
||||
from datetime import datetime, timezone
|
||||
|
||||
|
||||
def setup_logging(debug: bool = False) -> None:
|
||||
level = logging.DEBUG if debug else logging.INFO
|
||||
logging.basicConfig(level=level, format='%(asctime)s %(levelname)s %(name)s: %(message)s')
|
||||
|
||||
|
||||
def save_debug_artifact(filename: str, content: str | bytes) -> str:
|
||||
debug_dir = "debug"
|
||||
os.makedirs(debug_dir, exist_ok=True)
|
||||
timestamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
||||
path = os.path.join(debug_dir, f"{timestamp}_{filename}")
|
||||
mode = 'wb' if isinstance(content, (bytes, bytearray)) else 'w'
|
||||
with open(path, mode) as f:
|
||||
f.write(content) # type: ignore[arg-type]
|
||||
return path
|
||||
Reference in New Issue
Block a user