From 5c370ef3558b0809c6086b25fc967fa040823740 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 13 Apr 2022 22:13:57 +0200 Subject: [PATCH] Log early OCPP command payload MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 81855cec..4ed293e4 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1504,17 +1504,17 @@ export default class ChargingStation { if (this.getEnableStatistics()) { this.performanceStatistics.addRequestStatistic(commandName, messageType); } + logger.debug( + `${this.logPrefix()} << Command '${commandName}' received request payload: ${JSON.stringify( + request + )}` + ); // Process the call await this.ocppIncomingRequestService.handleRequest( messageId, commandName, commandPayload ); - logger.debug( - `${this.logPrefix()} << Command '${commandName}' received request payload: ${JSON.stringify( - request - )}` - ); break; // Outcome Message case MessageType.CALL_RESULT_MESSAGE: @@ -1529,6 +1529,11 @@ export default class ChargingStation { requestCommandName ); } + logger.debug( + `${this.logPrefix()} << Command '${requestCommandName}' received response payload: ${JSON.stringify( + request + )}` + ); if (!responseCallback) { // Error throw new OCPPError( @@ -1538,11 +1543,6 @@ export default class ChargingStation { ); } responseCallback(commandName, requestPayload); - logger.debug( - `${this.logPrefix()} << Command '${requestCommandName}' received response payload: ${JSON.stringify( - request - )}` - ); break; // Error Message case MessageType.CALL_ERROR_MESSAGE: @@ -1555,6 +1555,11 @@ export default class ChargingStation { `Cached request for message id ${messageId} error response is not iterable` ); } + logger.debug( + `${this.logPrefix()} << Command '${requestCommandName}' received error payload: ${JSON.stringify( + request + )}` + ); if (!rejectCallback) { // Error throw new OCPPError( @@ -1566,11 +1571,6 @@ export default class ChargingStation { rejectCallback( new OCPPError(commandName, commandPayload.toString(), requestCommandName, errorDetails) ); - logger.debug( - `${this.logPrefix()} << Command '${requestCommandName}' received error payload: ${JSON.stringify( - request - )}` - ); break; // Error default: -- 2.34.1