chore(logging): normalize wakeup flow observability with timings and summaries
Standardize console prefixes across scheduler, push, refresh, register, auth, and debug endpoints. Add pass-level scheduler summaries, elapsed-time logs, and masked-token-only push failure messages while reducing per-device noise in scheduler loops.
This commit is contained in:
17
src/util/formatElapsed.ts
Normal file
17
src/util/formatElapsed.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/** Human-readable duration for console logs (e.g. 842ms, 2.1s). */
|
||||
export function formatElapsedMs(elapsedMs: number): string {
|
||||
if (elapsedMs < 1000) {
|
||||
return `${Math.round(elapsedMs)}ms`;
|
||||
}
|
||||
return `${(elapsedMs / 1000).toFixed(1)}s`;
|
||||
}
|
||||
|
||||
export function errorMessage(err: unknown): string {
|
||||
if (err instanceof Error && err.message.length > 0) {
|
||||
return err.message;
|
||||
}
|
||||
if (typeof err === "string" && err.length > 0) {
|
||||
return err;
|
||||
}
|
||||
return "Unknown error";
|
||||
}
|
||||
Reference in New Issue
Block a user