chore(logging): strip redundant provider tags

This commit is contained in:
Peter Steinberger
2026-01-13 04:35:48 +00:00
parent 62bdbe1821
commit ccc24e2c26
2 changed files with 31 additions and 1 deletions

View File

@@ -9,6 +9,12 @@ describe("stripRedundantSubsystemPrefixForConsole", () => {
).toBe("hello");
});
it("drops '<Subsystem>:' prefix case-insensitively", () => {
expect(
stripRedundantSubsystemPrefixForConsole("WhatsApp: hello", "whatsapp"),
).toBe("hello");
});
it("drops '<subsystem> ' prefix", () => {
expect(
stripRedundantSubsystemPrefixForConsole(
@@ -18,6 +24,15 @@ describe("stripRedundantSubsystemPrefixForConsole", () => {
).toBe("gateway: closed");
});
it("drops '[subsystem]' prefix", () => {
expect(
stripRedundantSubsystemPrefixForConsole(
"[discord] connection stalled",
"discord",
),
).toBe("connection stalled");
});
it("keeps messages that do not start with the subsystem", () => {
expect(
stripRedundantSubsystemPrefixForConsole("discordant: hello", "discord"),