Fix and add log messages
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStation.ts
index a87ef6f2145bf6c89cd8a946bb27a593366290ee..547a4f3693321bf271d23cdae07c6cb51df01876 100644 (file)
@@ -65,6 +65,7 @@ import {
   type IncomingRequest,
   IncomingRequestCommand,
   type MeterValuesRequest,
+  type OutgoingRequest,
   RequestCommand,
   type ResponseCallback,
   type StatusNotificationRequest,
@@ -769,6 +770,12 @@ export default class ChargingStation {
       this.messageBuffer.forEach((message) => {
         // TODO: evaluate the need to track performance
         this.wsConnection.send(message);
+        const [messageType] = JSON.parse(message) as OutgoingRequest | Response | ErrorResponse;
+        logger.debug(
+          `${this.logPrefix()} >> Buffered ${OCPPServiceUtils.getMessageTypeString(
+            messageType
+          )} payload sent: ${message}`
+        );
         this.messageBuffer.delete(message);
       });
     }