scrape / lib /progress.ts
kjbytes's picture
feat: add structured logging to reel API and pipeline
e162630
Raw
History Blame Contribute Delete
661 Bytes
import type { RenderProgress } from "@/types";
const progressMap = new Map<string, RenderProgress>();
export function setProgress(id: string, progress: RenderProgress) {
progressMap.set(id, progress);
// ponytail: every pipeline stage already routes through here, so one line here
// logs the whole run instead of scattering console.log across the pipeline
console.log(
`[reel ${id.slice(0, 8)}] ${progress.percent}% ${progress.stage}${progress.message}`,
);
}
export function getProgress(id: string): RenderProgress | null {
return progressMap.get(id) ?? null;
}
export function clearProgress(id: string) {
progressMap.delete(id);
}