import CommandStatistics, { CommandStatisticsData, PerfEntry } from '../types/CommandStatistics';
-import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/1.6/Requests';
+import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests';
import CircularArray from './CircularArray';
import Configuration from './Configuration';
private objId: string;
private commandsStatistics: CommandStatistics;
- public constructor(objName: string) {
- this.objId = objName;
- this.commandsStatistics = { id: this.objId ? this.objId : ' Object id not specified', commandsStatisticsData: {} } as CommandStatistics;
+ public constructor(objId: string) {
+ this.objId = objId;
+ this.commandsStatistics = { id: this.objId ? this.objId : 'Object id not specified', commandsStatisticsData: {} };
}
public addMessage(command: RequestCommand | IncomingRequestCommand, messageType: MessageType): void {
}
break;
default:
- logger.error(`${this._logPrefix()} Wrong message type ${messageType}`);
+ logger.error(`${this.logPrefix()} Wrong message type ${messageType}`);
break;
}
}
perfEntry.entryType = entry.entryType;
perfEntry.startTime = entry.startTime;
perfEntry.duration = entry.duration;
- logger.info(`${this._logPrefix()} object ${className} method(s) performance entry: %j`, perfEntry);
+ logger.info(`${this.logPrefix()} object ${className} method(s) performance entry: %j`, perfEntry);
}
public start(): void {
- this._displayInterval();
+ this.displayInterval();
}
- private _display(): void {
- logger.info(this._logPrefix() + ' %j', this.commandsStatistics);
+ private display(): void {
+ logger.info(this.logPrefix() + ' %j', this.commandsStatistics);
}
- private _displayInterval(): void {
+ private displayInterval(): void {
if (Configuration.getStatisticsDisplayInterval() > 0) {
setInterval(() => {
- this._display();
+ this.display();
}, Configuration.getStatisticsDisplayInterval() * 1000);
- logger.info(this._logPrefix() + ' displayed every ' + Utils.secondsToHHMMSS(Configuration.getStatisticsDisplayInterval()));
+ logger.info(this.logPrefix() + ' displayed every ' + Utils.secondsToHHMMSS(Configuration.getStatisticsDisplayInterval()));
}
}
this.commandsStatistics.commandsStatisticsData[command].medTimeMeasurement = this.median(this.commandsStatistics.commandsStatisticsData[command].timeMeasurementSeries);
}
- private _logPrefix(): string {
+ private logPrefix(): string {
return Utils.logPrefix(` ${this.objId} Statistics:`);
}
}