From: Jérôme Benoit Date: Tue, 30 Nov 2021 21:03:16 +0000 (+0100) Subject: Refine UI WS service log messages X-Git-Tag: v1.1.36~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=410a760d4c5c78005eede71c94acb6e9a56593c9;p=e-mobility-charging-stations-simulator.git Refine UI WS service log messages Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/UIWebSocketServer.ts b/src/charging-station/UIWebSocketServer.ts index 78ca7516..f941b138 100644 --- a/src/charging-station/UIWebSocketServer.ts +++ b/src/charging-station/UIWebSocketServer.ts @@ -30,7 +30,7 @@ export default class UIWebSocketServer extends WebSocket.Server { const version = socket.protocol.substring(protocolIndex + Protocol.UI.length) as ProtocolVersion; this.uiService = UIServiceFactory.getUIServiceImplementation(version, this); if (!this.uiService) { - throw new BaseError(`Could not find a UI service implementation for protocol version ${version}`); + throw new BaseError(`Could not find a UI service implementation for UI protocol version ${version}`); } // FIXME: check connection validity socket.on('message', (messageData) => { @@ -39,7 +39,7 @@ export default class UIWebSocketServer extends WebSocket.Server { if (Utils.isIterable(protocolRequest)) { [command, payload] = protocolRequest; } else { - throw new BaseError('Protocol request is not iterable'); + throw new BaseError('UI protocol request is not iterable'); } this.uiService.handleMessage(command, payload).catch(() => { logger.error(`${this.logPrefix()} Error while handling command %s message: %j`, command, payload); @@ -56,6 +56,6 @@ export default class UIWebSocketServer extends WebSocket.Server { } public logPrefix(): string { - return Utils.logPrefix('WebSocket Server:'); + return Utils.logPrefix(' UI WebSocket Server:'); } } diff --git a/src/charging-station/UIWebSocketServices/AbstractUIService.ts b/src/charging-station/UIWebSocketServices/AbstractUIService.ts index fafcdb6d..a817c859 100644 --- a/src/charging-station/UIWebSocketServices/AbstractUIService.ts +++ b/src/charging-station/UIWebSocketServices/AbstractUIService.ts @@ -12,7 +12,6 @@ export default abstract class AbstractUIService { constructor(uiWebSocketServer: UIWebSocketServer) { this.chargingStations = new Set(); this.uiWebSocketServer = uiWebSocketServer; - // TODO: Move the shared service code to AbstractUIService this.messageHandlers = new Map([ [ProtocolCommand.LIST_CHARGING_STATIONS, this.handleListChargingStations.bind(this)], ]); diff --git a/src/charging-station/UIWebSocketServices/UIServiceUtils.ts b/src/charging-station/UIWebSocketServices/UIServiceUtils.ts index f95a7485..2c37e80a 100644 --- a/src/charging-station/UIWebSocketServices/UIServiceUtils.ts +++ b/src/charging-station/UIWebSocketServices/UIServiceUtils.ts @@ -17,7 +17,7 @@ export class UIServiceUtils { return fullProtocol; } } - logger.error(`${Utils.logPrefix('WebSocket Server:')} Unsupported protocol: ${protocol} or protocol version: ${version}`); + logger.error(`${Utils.logPrefix(' UI WebSocket Server:')} Unsupported protocol: ${protocol} or protocol version: ${version}`); return false; }; }