refactor: cleanup log messages
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 26 Jul 2023 00:09:57 +0000 (02:09 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 26 Jul 2023 00:09:57 +0000 (02:09 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts
src/performance/PerformanceStatistics.ts

index 0f2f5217956100920f6c1377e21ad5b6105017dd..7e444c5442a6db93d22d329308d22175464bec9e 100644 (file)
@@ -592,14 +592,14 @@ export class ChargingStation {
   public startMeterValues(connectorId: number, interval: number): void {
     if (connectorId === 0) {
       logger.error(
-        `${this.logPrefix()} Trying to start MeterValues on connector id ${connectorId.toString()}`,
+        `${this.logPrefix()} Trying to start MeterValues on connector id ${connectorId}`,
       );
       return;
     }
     if (!this.getConnectorStatus(connectorId)) {
       logger.error(
         `${this.logPrefix()} Trying to start MeterValues on non existing connector id
-          ${connectorId.toString()}`,
+          ${connectorId}`,
       );
       return;
     }
@@ -1025,11 +1025,12 @@ export class ChargingStation {
   public startReservationExpirationSetInterval(customInterval?: number): void {
     const interval =
       customInterval ?? Constants.DEFAULT_RESERVATION_EXPIRATION_OBSERVATION_INTERVAL;
-    logger.info(
-      `${this.logPrefix()} Reservation expiration date interval is set to ${interval}
-        and starts on charging station now`,
-    );
     if (interval > 0) {
+      logger.info(
+        `${this.logPrefix()} Reservation expiration date checks started every ${formatDurationMilliSeconds(
+          interval,
+        )}`,
+      );
       this.reservationExpirationSetInterval = setInterval((): void => {
         const currentDate = new Date();
         if (this.hasEvses) {
index e3899cd5db97ffca80caaa8dc2cbe0b88ddcb829..d0afb3678dcdacf99b1682ed3397079027d38031 100644 (file)
@@ -37,7 +37,6 @@ import {
   DCElectricUtils,
   convertToFloat,
   convertToInt,
-  formatDurationMilliSeconds,
   getRandomFloatFluctuatedRounded,
   getRandomFloatRounded,
   getRandomInteger,
@@ -727,9 +726,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
           `${chargingStation.logPrefix()} MeterValues measurand ${
             meterValue.sampledValue[sampledValuesIndex].measurand ??
             OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
-          }: connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${energyValueRounded}/${connectorMaximumEnergyRounded}, duration: ${formatDurationMilliSeconds(
-            interval,
-          )}(${roundTo(interval, 4)}ms)`,
+          }: connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${energyValueRounded}/${connectorMaximumEnergyRounded}, duration: ${interval}ms`,
         );
       }
     }
index 479fe0710b26b65797a3df973c99c744d8e6ba3c..8451a19339c8e2dcfc8d639513c2c0dc4b5d70b8 100644 (file)
@@ -195,7 +195,7 @@ export class PerformanceStatistics {
       );
     } else if (logConfiguration.enabled) {
       logger.info(
-        `${this.logPrefix()} log interval is set to ${logStatisticsInterval?.toString()}. Not logging statistics`,
+        `${this.logPrefix()} log interval is set to ${logStatisticsInterval}. Not logging statistics`,
       );
     }
   }