Simplify ATG logPrefix() method
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 1 Jun 2022 20:19:57 +0000 (22:19 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 1 Jun 2022 20:19:57 +0000 (22:19 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
package-lock.json
package.json
src/charging-station/AutomaticTransactionGenerator.ts

index d03035d2742b516b4bdf3468e5535bd7d9b5a037..3216c9af1eebe792a4443aaf30cc43ac3a2a2f23 100644 (file)
@@ -61,7 +61,7 @@
         "prettier": "^2.6.2",
         "release-it": "^15.0.0",
         "robohydra": "^0.6.9",
-        "rollup": "^2.75.4",
+        "rollup": "^2.75.5",
         "rollup-plugin-analyzer": "^4.0.0",
         "rollup-plugin-copy": "^3.4.0",
         "rollup-plugin-delete": "^2.0.0",
       }
     },
     "node_modules/rollup": {
-      "version": "2.75.4",
-      "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.75.4.tgz",
-      "integrity": "sha512-JgZiJMJkKImMZJ8ZY1zU80Z2bA/TvrL/7D9qcBCrfl2bP+HUaIw0QHUroB4E3gBpFl6CRFM1YxGbuYGtdAswbQ==",
+      "version": "2.75.5",
+      "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.75.5.tgz",
+      "integrity": "sha512-JzNlJZDison3o2mOxVmb44Oz7t74EfSd1SQrplQk0wSaXV7uLQXtVdHbxlcT3w+8tZ1TL4r/eLfc7nAbz38BBA==",
       "dev": true,
       "bin": {
         "rollup": "dist/bin/rollup"
       }
     },
     "rollup": {
-      "version": "2.75.4",
-      "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.75.4.tgz",
-      "integrity": "sha512-JgZiJMJkKImMZJ8ZY1zU80Z2bA/TvrL/7D9qcBCrfl2bP+HUaIw0QHUroB4E3gBpFl6CRFM1YxGbuYGtdAswbQ==",
+      "version": "2.75.5",
+      "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.75.5.tgz",
+      "integrity": "sha512-JzNlJZDison3o2mOxVmb44Oz7t74EfSd1SQrplQk0wSaXV7uLQXtVdHbxlcT3w+8tZ1TL4r/eLfc7nAbz38BBA==",
       "dev": true,
       "requires": {
         "fsevents": "~2.3.2"
index 4cd71187312fd53b20f12393f7c5efd0cc21af60..cbcc6b14d9c6266fc3e5fdc1ccd7e4b6695c2a80 100644 (file)
     "prettier": "^2.6.2",
     "release-it": "^15.0.0",
     "robohydra": "^0.6.9",
-    "rollup": "^2.75.4",
+    "rollup": "^2.75.5",
     "rollup-plugin-analyzer": "^4.0.0",
     "rollup-plugin-copy": "^3.4.0",
     "rollup-plugin-delete": "^2.0.0",
index fedda8ef3d032f67bbcde78796ab0af6d44379d3..31f0716886aa57f74d615e758a7b0cf8a1570300 100644 (file)
@@ -103,7 +103,7 @@ export default class AutomaticTransactionGenerator {
   }
 
   private async internalStartConnector(connectorId: number): Promise<void> {
-    this.initStartConnectorStatus(connectorId);
+    this.initializeConnectorStatus(connectorId);
     logger.info(
       this.logPrefix(connectorId) +
         ' started on connector and will run for ' +
@@ -238,7 +238,7 @@ export default class AutomaticTransactionGenerator {
     });
   }
 
-  private initStartConnectorStatus(connectorId: number): void {
+  private initializeConnectorStatus(connectorId: number): void {
     this.connectorsStatus.get(connectorId).authorizeRequests =
       this?.connectorsStatus.get(connectorId)?.authorizeRequests ?? 0;
     this.connectorsStatus.get(connectorId).acceptedAuthorizeRequests =
@@ -388,15 +388,10 @@ export default class AutomaticTransactionGenerator {
   }
 
   private logPrefix(connectorId?: number): string {
-    if (connectorId) {
-      return Utils.logPrefix(
-        ' ' +
-          this.chargingStation.stationInfo.chargingStationId +
-          ' | ATG on connector #' +
-          connectorId.toString() +
-          ':'
-      );
-    }
-    return Utils.logPrefix(' ' + this.chargingStation.stationInfo.chargingStationId + ' | ATG:');
+    return Utils.logPrefix(
+      ` ${this.chargingStation.stationInfo.chargingStationId} | ATG${
+        connectorId && ` on connector #${connectorId.toString()}`
+      }:`
+    );
   }
 }