From: Jérôme Benoit Date: Wed, 26 Jul 2023 00:09:57 +0000 (+0200) Subject: refactor: cleanup log messages X-Git-Tag: v1.2.20~134 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=04c32a956205b29f2f5d7a1ac1b28a9f3e9d39c1;p=e-mobility-charging-stations-simulator.git refactor: cleanup log messages Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 0f2f5217..7e444c54 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -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) { diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index e3899cd5..d0afb367 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -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`, ); } } diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index 479fe071..8451a193 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -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`, ); } }