added error handling system in logger

This commit is contained in:
2025-12-31 13:14:47 -05:00
parent cf8f0fbc34
commit 6139f12e13
2 changed files with 30 additions and 12 deletions

View File

@@ -29,7 +29,11 @@ function emitLog(header: LogHeader, payload: LogPayload = {}) {
if (!shouldLog(header.depth)) return;
const logLine = { ...header, ...payload };
console.log(JSON.stringify(logLine));
if (header.level === 'error')
console.error(JSON.stringify(logLine))
else
console.log(JSON.stringify(logLine));
}
export const logger = {