Server fs log shouldn't be JSON
Summary: The logs written to the file shouldn't be JSON. It just makes it hard to read and there's no tool to process this either. Instead, write the logs as seeing in the console for easier reading. Reviewed By: antonk52 Differential Revision: D50219806 fbshipit-source-id: a07fb53a10b36e1a3c2992a133b8c0c818bd816b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0c701eeffb
commit
8cc35d74ef
@@ -54,20 +54,14 @@ export async function initializeLogger(
|
|||||||
|
|
||||||
addLogTailer((level: LoggerTypes, ...data: Array<any>) => {
|
addLogTailer((level: LoggerTypes, ...data: Array<any>) => {
|
||||||
const logInfo = LoggerFormat(level, ...data);
|
const logInfo = LoggerFormat(level, ...data);
|
||||||
logStream?.write(`${JSON.stringify(logInfo)}\n`);
|
logStream?.write(`[${logInfo.time}][${logInfo.type}] ${logInfo.msg}\n`);
|
||||||
|
|
||||||
if (level === 'error') {
|
if (level === 'error') {
|
||||||
const {
|
const {
|
||||||
message,
|
error: {stack, name},
|
||||||
error: {stack, interaction, name},
|
|
||||||
} = LoggerExtractError(data);
|
} = LoggerExtractError(data);
|
||||||
const logInfo = LoggerFormat(level, {
|
|
||||||
name,
|
logStream?.write(`${name}: \n${stack}\n`);
|
||||||
stack,
|
|
||||||
interaction,
|
|
||||||
message,
|
|
||||||
});
|
|
||||||
logStream?.write(`${JSON.stringify(logInfo)}\n`);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user