chore(logging): strip redundant console prefixes

This commit is contained in:
Peter Steinberger
2026-01-13 04:27:28 +00:00
parent 58d1d11762
commit 62bdbe1821
2 changed files with 51 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
import { describe, expect, it } from "vitest";
import { stripRedundantSubsystemPrefixForConsole } from "../logging.js";
describe("stripRedundantSubsystemPrefixForConsole", () => {
it("drops '<subsystem>:' prefix", () => {
expect(
stripRedundantSubsystemPrefixForConsole("discord: hello", "discord"),
).toBe("hello");
});
it("drops '<subsystem> ' prefix", () => {
expect(
stripRedundantSubsystemPrefixForConsole(
"discord gateway: closed",
"discord",
),
).toBe("gateway: closed");
});
it("keeps messages that do not start with the subsystem", () => {
expect(
stripRedundantSubsystemPrefixForConsole("discordant: hello", "discord"),
).toBe("discordant: hello");
});
});