fix(logs-viewer): fail to search json logs [EE-4857] (#8482)

pull/8582/head
cmeng 2023-03-02 23:55:13 +13:00 committed by GitHub
parent 6074d1fcb5
commit 085381e6fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -119,15 +119,17 @@ export function formatKeyValuePair(
) { ) {
let nl = line; let nl = line;
const strValue = typeof value !== 'string' ? JSON.stringify(value) : value;
spans.push( spans.push(
{ fgColor: Colors.Blue, text: `${key}=` }, { fgColor: Colors.Blue, text: `${key}=` },
{ {
fgColor: key === 'error' || key === 'ERR' ? Colors.Red : Colors.Magenta, fgColor: key === 'error' || key === 'ERR' ? Colors.Red : Colors.Magenta,
text: value as string, text: strValue,
} }
); );
if (!isLastKey) spans.push(spaceSpan); if (!isLastKey) spans.push(spaceSpan);
nl += `${key}=${value}${!isLastKey ? ' ' : ''}`; nl += `${key}=${strValue}${!isLastKey ? ' ' : ''}`;
return nl; return nl;
} }