dc7686f507
Add progress logging and a status script for postal imports and neighbor builds, and ignore local raw and generated postal datasets.
23 lines
619 B
TypeScript
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()})`);
|
|
},
|
|
};
|
|
}
|