From: Jérôme Benoit Date: Sun, 28 Aug 2022 13:59:08 +0000 (+0200) Subject: Uniformize log messages format X-Git-Tag: v1.1.68~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5cf9050d18e0fd83636ac933793848a5000b4326;p=e-mobility-charging-stations-simulator.git Uniformize log messages format Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 8869a775..a6408d2b 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -281,6 +281,9 @@ export default class AutomaticTransactionGenerator { let startResponse: StartTransactionResponse; if (this.chargingStation.hasAuthorizedTags()) { const idTag = this.chargingStation.getRandomIdTag(); + const startTransactionLogMsg = `${this.logPrefix( + connectorId + )} start transaction for idTag '${idTag}'`; if (this.getRequireAuthorize()) { this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag = idTag; // Authorize idTag @@ -294,7 +297,7 @@ export default class AutomaticTransactionGenerator { this.connectorsStatus.get(connectorId).authorizeRequests++; if (authorizeResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { this.connectorsStatus.get(connectorId).acceptedAuthorizeRequests++; - logger.info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag); + logger.info(startTransactionLogMsg); // Start transaction startResponse = await this.chargingStation.ocppRequestService.requestHandler< StartTransactionRequest, @@ -310,7 +313,7 @@ export default class AutomaticTransactionGenerator { PerformanceStatistics.endMeasure(measureId, beginId); return authorizeResponse; } - logger.info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag); + logger.info(startTransactionLogMsg); // Start transaction startResponse = await this.chargingStation.ocppRequestService.requestHandler< StartTransactionRequest, @@ -322,7 +325,7 @@ export default class AutomaticTransactionGenerator { PerformanceStatistics.endMeasure(measureId, beginId); return startResponse; } - logger.info(this.logPrefix(connectorId) + ' start transaction without an idTag'); + logger.info(`${this.logPrefix(connectorId)} start transaction without an idTag`); startResponse = await this.chargingStation.ocppRequestService.requestHandler< StartTransactionRequest, StartTransactionResponse diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index c870fbc1..4f4db668 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -831,8 +831,9 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer chargingStation.stationInfo.chargingStationId + '#' + transactionConnectorId.toString() + - ' for idTag ' + - commandPayload.idTag + " for idTag '" + + commandPayload.idTag + + "'" ); return Constants.OCPP_RESPONSE_ACCEPTED; } @@ -880,8 +881,9 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer chargingStation.stationInfo.chargingStationId + '#' + transactionConnectorId.toString() + - ' for idTag ' + - commandPayload.idTag + " for idTag '" + + commandPayload.idTag + + "'" ); return Constants.OCPP_RESPONSE_ACCEPTED; } diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index d765e1d2..c7ab237a 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -292,15 +292,15 @@ export default class OCPP16ResponseService extends OCPPResponseService { if (payload.idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED) { chargingStation.getConnectorStatus(authorizeConnectorId).idTagAuthorized = true; logger.debug( - `${chargingStation.logPrefix()} IdTag ${ + `${chargingStation.logPrefix()} IdTag '${ requestPayload.idTag - } authorized on connector ${authorizeConnectorId}` + }' authorized on connector ${authorizeConnectorId}` ); } else { chargingStation.getConnectorStatus(authorizeConnectorId).idTagAuthorized = false; delete chargingStation.getConnectorStatus(authorizeConnectorId).authorizeIdTag; logger.debug( - `${chargingStation.logPrefix()} IdTag ${requestPayload.idTag} refused with status '${ + `${chargingStation.logPrefix()} IdTag '${requestPayload.idTag}' refused with status '${ payload.idTagInfo.status }' on connector ${authorizeConnectorId}` ); @@ -465,8 +465,9 @@ export default class OCPP16ResponseService extends OCPPResponseService { chargingStation.stationInfo.chargingStationId + '#' + connectorId.toString() + - ' for idTag ' + - requestPayload.idTag + " for idTag '" + + requestPayload.idTag + + "'" ); if (chargingStation.stationInfo.powerSharedByConnectors) { chargingStation.powerDivider++; diff --git a/src/ui/web/src/composables/UIClient.ts b/src/ui/web/src/composables/UIClient.ts index 8f76c532..275e30e9 100644 --- a/src/ui/web/src/composables/UIClient.ts +++ b/src/ui/web/src/composables/UIClient.ts @@ -108,7 +108,7 @@ export default class UIClient { resolve: (value: ResponsePayload | PromiseLike) => void, reject: (reason?: any) => void ): void { - this._responseHandlers.set(id, { resolve, reject, procedureName }); + this._responseHandlers.set(id, { procedureName, resolve, reject }); } private getResponseHandler(id: string): ResponseHandler | undefined {