Public Access
1
0
Files
leads4less/db/scripts/postal-logging.ts
T
pguerrerox dc7686f507 chore: improve postal data import observability
Add progress logging and a status script for postal imports and neighbor builds, and ignore local raw and generated postal datasets.
2026-04-12 23:22:36 +00:00

23 lines
619 B
TypeScript

export function createScriptLogger(prefix: string) {
const startedAt = Date.now();
function elapsed() {
const totalSeconds = Math.floor((Date.now() - startedAt) / 1000);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
return `${minutes}m ${seconds}s`;
}
return {
info(message: string) {
console.log(`[${prefix}] ${message} (${elapsed()})`);
},
warn(message: string) {
console.warn(`[${prefix}] ${message} (${elapsed()})`);
},
error(message: string) {
console.error(`[${prefix}] ${message} (${elapsed()})`);
},
};
}