mirror of
https://github.com/IrosTheBeggar/mStream.git
synced 2025-10-27 07:31:02 +00:00
improve logger to handle thrown strings
This commit is contained in:
parent
b7e07c080f
commit
598ed74bd4
@ -7,7 +7,11 @@ let fileTransport;
|
||||
const myFormat = winston.format.printf(info => {
|
||||
let msg = `${info.timestamp} ${info.level}: ${info.message}`;
|
||||
if (!info.stack) { return msg; }
|
||||
const stackStr = JSON.parse(JSON.stringify(info.stack, Object.getOwnPropertyNames(info.stack)));
|
||||
|
||||
const stackStr = typeof info.stack === 'string' ?
|
||||
{ stack: info.stack } :
|
||||
JSON.parse(JSON.stringify(info.stack, Object.getOwnPropertyNames(info.stack)));
|
||||
|
||||
return msg += os.EOL + stackStr.stack;
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user