chore: alias console subsystem names

This commit is contained in:
Peter Steinberger
2025-12-22 23:06:15 +00:00
parent ca806897c2
commit 91238df13f

View File

@@ -372,6 +372,13 @@ const SUBSYSTEM_COLORS = [
] as const;
const SUBSYSTEM_PREFIXES_TO_DROP = ["gateway", "providers"] as const;
const SUBSYSTEM_MAX_SEGMENTS = 2;
const SUBSYSTEM_DISPLAY_ALIASES = new Map<string, string>([
["whatsapp/inbound", "WhatsApp In"],
["whatsapp/outbound", "WhatsApp Out"],
["whatsapp/heartbeat", "WhatsApp Heartbeat"],
["whatsapp", "WhatsApp"],
["telegram", "Telegram"],
]);
function pickSubsystemColor(
color: ChalkInstance,
@@ -399,9 +406,11 @@ function formatSubsystemForConsole(subsystem: string): string {
}
if (parts.length === 0) return original;
if (parts.length > SUBSYSTEM_MAX_SEGMENTS) {
return parts.slice(-SUBSYSTEM_MAX_SEGMENTS).join("/");
const shortened = parts.slice(-SUBSYSTEM_MAX_SEGMENTS).join("/");
return SUBSYSTEM_DISPLAY_ALIASES.get(shortened) ?? shortened;
}
return parts.join("/");
const shortened = parts.join("/");
return SUBSYSTEM_DISPLAY_ALIASES.get(shortened) ?? shortened;
}
function formatConsoleLine(opts: {