Unbreak error logging

Summary:
*Potentially.

A big thanks to lblasa and aigoncharov for helping with debugging. Looking at
`ptail -f errorlog_flipper_javascript` reveals that messages now include a spurious amount of unescaped newlines. E.g. P768993195

From memory, these were not there when I wrote the categorizer when I was able to copy-paste from ptail to the unit tests.

D44729490 added prettifying to the results inadvertently.

Reviewed By: lblasa

Differential Revision: D46685543

fbshipit-source-id: 98da5eff92900042fc5306ca5d5652d8940ff2e1
This commit is contained in:
Pascal Hartig
2023-06-13 08:17:03 -07:00
committed by Facebook GitHub Bot
parent 6108769464
commit bf2f1283d3

View File

@@ -7,9 +7,9 @@
* @format * @format
*/ */
export function safeStringify(value: any) { export function safeStringify(value: any, space: number = 2) {
try { try {
return JSON.stringify(value, null, 2); return JSON.stringify(value, null, space);
} catch (e) { } catch (e) {
return '<Failed to serialize: ' + e + '>'; return '<Failed to serialize: ' + e + '>';
} }