INNER CODE UNIT · Python
_append_log
Nuclear-Marmalade/dataforge · forge/dashboard/app.py:156
def _append_log(msg: str):
"""Append a message to the enrichment log (keeps last 10)."""
import html as _html
ts = datetime.now().strftime("%H:%M:%S")
safe_msg = _html.escape(str(msg))
with _enrichment_lock:
_enrichment_stats["log_messages"].append(f"[{ts}] {safe_msg}")
_enrichment_stats["log_messages"] = _enrichment_stats["log_messages"][-10:]
def _init_enrichment(mode: str, workers: int) -> tuple:
"""Initialize enrichment state and return (db, total) or (None, 0) on error."""
global _enrichment_stats
_append_log(f"Starting enrichment: mode={mode}, workers={workers}")
with _enrichment_lock:
_enrichment_stats["started_at"] = time.time()