added error handling system in logger
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user