From 8cc35d74efe8669fff50fadda2909fd934a3d3ed Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Thu, 12 Oct 2023 04:29:13 -0700 Subject: [PATCH] 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 --- desktop/flipper-server/src/logger.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/desktop/flipper-server/src/logger.tsx b/desktop/flipper-server/src/logger.tsx index 14b4c3b90..484e964a7 100644 --- a/desktop/flipper-server/src/logger.tsx +++ b/desktop/flipper-server/src/logger.tsx @@ -54,20 +54,14 @@ export async function initializeLogger( addLogTailer((level: LoggerTypes, ...data: Array) => { const logInfo = LoggerFormat(level, ...data); - logStream?.write(`${JSON.stringify(logInfo)}\n`); + logStream?.write(`[${logInfo.time}][${logInfo.type}] ${logInfo.msg}\n`); if (level === 'error') { const { - message, - error: {stack, interaction, name}, + error: {stack, name}, } = LoggerExtractError(data); - const logInfo = LoggerFormat(level, { - name, - stack, - interaction, - message, - }); - logStream?.write(`${JSON.stringify(logInfo)}\n`); + + logStream?.write(`${name}: \n${stack}\n`); } }); }