fix: highlight keywords in logs (#405)

This commit is contained in:
Fine0830
2024-07-30 10:39:18 +08:00
committed by GitHub
parent 8f179f00a2
commit 4e00073ec2
2 changed files with 1 additions and 4 deletions

View File

@@ -61,7 +61,7 @@ limitations under the License. -->
return (props.data.tags.find((d: { key: string; value: string }) => d.key === "level") || {}).value || "";
});
const highlightKeywords = (data: string) => {
const keywords = Object.values(logStore.getLogKeywords());
const keywords = Object.values(logStore.conditions.keywordsOfContent || {});
const regex = new RegExp(keywords.join("|"), "gi");
return data.replace(regex, (match) => `<span style="color: red">${match}</span>`);
};