From 82529f4826c61247182401807183b1b9efd7357a Mon Sep 17 00:00:00 2001 From: Nimrod Gutman Date: Mon, 26 Jan 2026 10:13:59 +0200 Subject: [PATCH] chore(logs): split gateway log categories --- apps/macos/Sources/Moltbot/GatewayConnection.swift | 3 ++- .../shared/MoltbotKit/Sources/MoltbotKit/GatewayChannel.swift | 4 +++- .../MoltbotKit/Sources/MoltbotKit/GatewayNodeSession.swift | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/macos/Sources/Moltbot/GatewayConnection.swift b/apps/macos/Sources/Moltbot/GatewayConnection.swift index d733c9c86..fbfeda855 100644 --- a/apps/macos/Sources/Moltbot/GatewayConnection.swift +++ b/apps/macos/Sources/Moltbot/GatewayConnection.swift @@ -367,7 +367,8 @@ actor GatewayConnection { session: self.sessionBox, pushHandler: { [weak self] push in await self?.handle(push: push) - }) + }, + loggerCategory: "gateway.control") self.configuredURL = url self.configuredToken = token self.configuredPassword = password diff --git a/apps/shared/MoltbotKit/Sources/MoltbotKit/GatewayChannel.swift b/apps/shared/MoltbotKit/Sources/MoltbotKit/GatewayChannel.swift index 917689541..accd53eee 100644 --- a/apps/shared/MoltbotKit/Sources/MoltbotKit/GatewayChannel.swift +++ b/apps/shared/MoltbotKit/Sources/MoltbotKit/GatewayChannel.swift @@ -109,7 +109,7 @@ private enum ConnectChallengeError: Error { } public actor GatewayChannelActor { - private let logger = Logger(subsystem: "bot.molt", category: "gateway") + private let logger: Logger private var task: WebSocketTaskBox? private var pending: [String: CheckedContinuation] = [:] private var connected = false @@ -143,8 +143,10 @@ public actor GatewayChannelActor { session: WebSocketSessionBox? = nil, pushHandler: (@Sendable (GatewayPush) async -> Void)? = nil, connectOptions: GatewayConnectOptions? = nil, + loggerCategory: String = "gateway", disconnectHandler: (@Sendable (String) async -> Void)? = nil) { + self.logger = Logger(subsystem: "bot.molt", category: loggerCategory) self.url = url self.token = token self.password = password diff --git a/apps/shared/MoltbotKit/Sources/MoltbotKit/GatewayNodeSession.swift b/apps/shared/MoltbotKit/Sources/MoltbotKit/GatewayNodeSession.swift index 3b0409953..9bfb66f38 100644 --- a/apps/shared/MoltbotKit/Sources/MoltbotKit/GatewayNodeSession.swift +++ b/apps/shared/MoltbotKit/Sources/MoltbotKit/GatewayNodeSession.swift @@ -90,6 +90,7 @@ public actor GatewayNodeSession { await self?.handlePush(push) }, connectOptions: connectOptions, + loggerCategory: "gateway.node", disconnectHandler: { [weak self] reason in await self?.onDisconnected?(reason) })