From bc464bb1fb95c50a14b25478d35be76b7d8e5498 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 17 Feb 2022 17:40:03 +0100 Subject: [PATCH] Enforce singleton design pattern for the logger MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- package-lock.json | 631 +++++++++--------- package.json | 18 +- .../AutomaticTransactionGenerator.ts | 38 +- src/charging-station/ChargingStation.ts | 96 +-- src/charging-station/UIWebSocketServer.ts | 6 +- .../ocpp/1.6/OCPP16IncomingRequestService.ts | 44 +- .../ocpp/1.6/OCPP16RequestService.ts | 18 +- .../ocpp/1.6/OCPP16ResponseService.ts | 44 +- .../ocpp/1.6/OCPP16ServiceUtils.ts | 6 +- .../ocpp/OCPPIncomingRequestService.ts | 4 +- .../ocpp/OCPPRequestService.ts | 6 +- .../AbstractUIService.ts | 4 +- .../ui-websocket-services/UIServiceUtils.ts | 4 +- src/performance/PerformanceStatistics.ts | 14 +- src/performance/storage/Storage.ts | 4 +- src/utils/FileUtils.ts | 10 +- src/utils/Logger.ts | 20 +- 17 files changed, 489 insertions(+), 478 deletions(-) diff --git a/package-lock.json b/package-lock.json index 54650370..b3071111 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,8 +22,8 @@ "tar": "^6.1.11", "tslib": "^2.3.1", "uuid": "^8.3.2", - "winston": "^3.5.1", - "winston-daily-rotate-file": "^4.6.0", + "winston": "^3.6.0", + "winston-daily-rotate-file": "^4.6.1", "ws": "^8.5.0" }, "devDependencies": { @@ -32,19 +32,19 @@ "@rollup/plugin-json": "^4.1.0", "@types/mocha": "^9.1.0", "@types/mochawesome": "^6.2.1", - "@types/node": "^16.11.22", + "@types/node": "^16.11.25", "@types/proper-lockfile": "^4.1.2", "@types/tar": "^6.1.1", "@types/uuid": "^8.3.4", "@types/ws": "^8.2.2", - "@typescript-eslint/eslint-plugin": "^5.11.0", - "@typescript-eslint/parser": "^5.11.0", + "@typescript-eslint/eslint-plugin": "^5.12.0", + "@typescript-eslint/parser": "^5.12.0", "auto-changelog": "^2.4.0", - "clinic": "^11.0.0", + "clinic": "^11.1.0", "cross-env": "^7.0.3", - "eslint": "^8.8.0", + "eslint": "^8.9.0", "eslint-plugin-import": "^2.25.4", - "eslint-plugin-jsdoc": "^37.8.0", + "eslint-plugin-jsdoc": "^37.9.2", "eslint-plugin-node": "^11.1.0", "expect": "^27.5.1", "mocha": "^9.2.0", @@ -53,7 +53,7 @@ "nyc": "^15.1.0", "release-it": "^14.12.4", "robohydra": "^0.6.9", - "rollup": "^2.67.1", + "rollup": "^2.67.2", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-delete": "^2.0.0", @@ -73,9 +73,9 @@ } }, "node_modules/@ampproject/remapping": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.1.0.tgz", - "integrity": "sha512-d5RysTlJ7hmw5Tw4UxgxcY3lkMe92n8sXCcuLPAyIAHK6j8DefDwtGnVVDgOnv+RnEosulDJ9NPKQL27bDId0g==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.1.2.tgz", + "integrity": "sha512-hoyByceqwKirw7w3Z7gnIIZC3Wx3J484Y3L/cMpXFbr7d9ZQj2mODrirNzcJa+SM3UlpWXYvKV4RlRpFXlWgXg==", "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.0" @@ -85,9 +85,9 @@ } }, "node_modules/@assemblyscript/loader": { - "version": "0.19.22", - "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.19.22.tgz", - "integrity": "sha512-ksrMVpPOatD7ZzXCw+c/g3zId5rm8MMnQe7P32dH/qtDrgT9SbQjJYEngRP0YhRF0qrBCga2PtpID7arqphGyg==", + "version": "0.19.23", + "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.19.23.tgz", + "integrity": "sha512-ulkCYfFbYj01ie1MDOyxv2F6SpRN1TOj7fQxbP07D6HmeR+gr2JLSmINKjga2emB+b1L2KGrFKBTc+e00p54nw==", "dev": true }, "node_modules/@babel/code-frame": { @@ -112,20 +112,20 @@ } }, "node_modules/@babel/core": { - "version": "7.17.2", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.2.tgz", - "integrity": "sha512-R3VH5G42VSDolRHyUO4V2cfag8WHcZyxdq5Z/m8Xyb92lW/Erm/6kM+XtRFGf3Mulre3mveni2NHfEUws8wSvw==", + "version": "7.17.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.4.tgz", + "integrity": "sha512-R9x5r4t4+hBqZTmioSnkrW+I6NmbojwjGT8p4G2Gw1thWbXIHGDnmGdLdFw0/7ljucdIrNRp7Npgb4CyBYzzJg==", "dev": true, "dependencies": { - "@ampproject/remapping": "^2.0.0", + "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.0", + "@babel/generator": "^7.17.3", "@babel/helper-compilation-targets": "^7.16.7", "@babel/helper-module-transforms": "^7.16.7", "@babel/helpers": "^7.17.2", - "@babel/parser": "^7.17.0", + "@babel/parser": "^7.17.3", "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.0", + "@babel/traverse": "^7.17.3", "@babel/types": "^7.17.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", @@ -166,9 +166,9 @@ } }, "node_modules/@babel/generator": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.0.tgz", - "integrity": "sha512-I3Omiv6FGOC29dtlZhkfXO6pgkmukJSlT26QjVvS1DGZe/NzSVCPG41X0tS21oZkJYlovfj9qDWgKP+Cn4bXxw==", + "version": "7.17.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.3.tgz", + "integrity": "sha512-+R6Dctil/MgUsZsZAkYgK+ADNSZzJRRy0TvY65T71z/CR854xHQ1EweBYXdfT+HNeN7w0cSJJEzgxZMv40pxsg==", "dev": true, "dependencies": { "@babel/types": "^7.17.0", @@ -429,9 +429,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.0.tgz", - "integrity": "sha512-VKXSCQx5D8S04ej+Dqsr1CzYvvWgf20jIw2D+YhQCrIlr2UZGaDds23Y0xg75/skOxpLCRpUZvk/1EAVkGoDOw==", + "version": "7.17.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.3.tgz", + "integrity": "sha512-7yJPvPV+ESz2IUTPbOL+YkIGyCqOyNIzdguKQuJGnH7bg1WTIifuM21YqokFt/THWh1AkCRn9IgoykTRCBVpzA==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -455,18 +455,18 @@ } }, "node_modules/@babel/traverse": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.0.tgz", - "integrity": "sha512-fpFIXvqD6kC7c7PUNnZ0Z8cQXlarCLtCUpt2S1Dx7PjoRtCFffvOkHHSom+m5HIxMZn5bIBVb71lhabcmjEsqg==", + "version": "7.17.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.3.tgz", + "integrity": "sha512-5irClVky7TxRWIRtxlh2WPUUOLhcPN06AGgaQSB8AEwuyEBgJVuJ5imdHm5zxk8w0QS5T+tDfnDxAlhWjpb7cw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.0", + "@babel/generator": "^7.17.3", "@babel/helper-environment-visitor": "^7.16.7", "@babel/helper-function-name": "^7.16.7", "@babel/helper-hoist-variables": "^7.16.7", "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.17.0", + "@babel/parser": "^7.17.3", "@babel/types": "^7.17.0", "debug": "^4.1.0", "globals": "^11.1.0" @@ -662,6 +662,14 @@ "turbo-json-parse": "^2.2.0" } }, + "node_modules/@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "engines": { + "node": ">=0.1.90" + } + }, "node_modules/@cspotcode/source-map-consumer": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", @@ -684,9 +692,9 @@ } }, "node_modules/@dabh/diagnostics": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz", - "integrity": "sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz", + "integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==", "dependencies": { "colorspace": "1.1.x", "enabled": "2.0.x", @@ -694,28 +702,28 @@ } }, "node_modules/@es-joy/jsdoccomment": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.18.0.tgz", - "integrity": "sha512-TjT8KJULV4I6ZiwIoKr6eMs+XpRejqwJ/VA+QPDeFGe9j6bZFKmMJ81EeFsGm6JNZhnzm37aoxVROmTh2PZoyA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.20.0.tgz", + "integrity": "sha512-uiNBw8wxbmXHxRlQJnzO5336F/CKsHD/Kp+J1ISuLA8LFBTKUjBEcOxZdXQTI+yhen4Lx5Qv9KbN6+FAMtkEVg==", "dev": true, "dependencies": { "comment-parser": "1.3.0", "esquery": "^1.4.0", - "jsdoc-type-pratt-parser": "~2.2.2" + "jsdoc-type-pratt-parser": "~2.2.3" }, "engines": { "node": "^12 || ^14 || ^16 || ^17" } }, "node_modules/@eslint/eslintrc": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz", - "integrity": "sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.1.0.tgz", + "integrity": "sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.2.0", + "espree": "^9.3.1", "globals": "^13.9.0", "ignore": "^4.0.6", "import-fresh": "^3.2.1", @@ -951,24 +959,24 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.4.tgz", - "integrity": "sha512-cz8HFjOFfUBtvN+NXYSFMHYRdxZMaEl0XypVrhzxBgadKIXhIkRd8aMeHhmF56Sl7SuS8OnUpQ73/k9LE4VnLg==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz", + "integrity": "sha512-VPeQ7+wH0itvQxnG+lIzWgkysKIr3L9sslimFW55rHMdGu/qCQ5z5h9zq4gI8uBtqkpHhsF4Z/OwExufUCThew==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.10", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.10.tgz", - "integrity": "sha512-Ht8wIW5v165atIX1p+JvKR5ONzUyF4Ac8DZIQ5kZs9zrb6M8SJNXpx1zn04rn65VjBMygRoMXcyYwNK0fT7bEg==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz", + "integrity": "sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.2.tgz", - "integrity": "sha512-9KzzH4kMjA2XmBRHfqG2/Vtl7s92l6uNDd0wW7frDE+EUvQFGqNXhWp0UGJjSkt3v2AYjzOZn1QO9XaTNJIt1Q==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.4.tgz", + "integrity": "sha512-vFv9ttIedivx0ux3QSjhgtCVjPZd5l46ZOMDSCwnH1yUO2e964gO8LZGyv2QkqcgR6TnBU1v+1IFqmeoG+0UJQ==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", @@ -976,9 +984,9 @@ } }, "node_modules/@mdn/browser-compat-data": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-4.1.6.tgz", - "integrity": "sha512-JbtcHGODAlkOT6eDV2rCyOguW3+o34ExMD9DOki6kxzeyN3IBtZ9PI0FlbKeD77Bm5U0UG5Heo4qnNbSajXUnw==", + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-4.1.8.tgz", + "integrity": "sha512-iY8qGU+yJvscccvWLyWPKfF9BSLmSFth5HBNjSNtIfoyUrQV3lTZml+zyKWRymMYCgvos6LiSqMj1RDEj3TehA==", "dev": true }, "node_modules/@mikro-orm/cli": { @@ -1702,9 +1710,9 @@ } }, "node_modules/@types/node": { - "version": "16.11.22", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.22.tgz", - "integrity": "sha512-DYNtJWauMQ9RNpesl4aVothr97/tIJM8HbyOXJ0AYT1Z2bEjLHyfjOBPAQQVMLf8h3kSShYfNk8Wnto8B2zHUA==" + "version": "16.11.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.25.tgz", + "integrity": "sha512-NrTwfD7L1RTc2qrHQD4RTTy4p0CO2LatKBEKEds3CaVuhoM/+DJzmWZl5f+ikR8cm8F5mfJxK+9rQq07gRiSjQ==" }, "node_modules/@types/object-path": { "version": "0.11.1", @@ -1861,14 +1869,14 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.11.0.tgz", - "integrity": "sha512-HJh33bgzXe6jGRocOj4FmefD7hRY4itgjzOrSs3JPrTNXsX7j5+nQPciAUj/1nZtwo2kAc3C75jZO+T23gzSGw==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz", + "integrity": "sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/type-utils": "5.11.0", - "@typescript-eslint/utils": "5.11.0", + "@typescript-eslint/scope-manager": "5.12.0", + "@typescript-eslint/type-utils": "5.12.0", + "@typescript-eslint/utils": "5.12.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -1894,14 +1902,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.11.0.tgz", - "integrity": "sha512-x0DCjetHZYBRovJdr3U0zG9OOdNXUaFLJ82ehr1AlkArljJuwEsgnud+Q7umlGDFLFrs8tU8ybQDFocp/eX8mQ==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.12.0.tgz", + "integrity": "sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/typescript-estree": "5.11.0", + "@typescript-eslint/scope-manager": "5.12.0", + "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/typescript-estree": "5.12.0", "debug": "^4.3.2" }, "engines": { @@ -1921,13 +1929,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.11.0.tgz", - "integrity": "sha512-z+K4LlahDFVMww20t/0zcA7gq/NgOawaLuxgqGRVKS0PiZlCTIUtX0EJbC0BK1JtR4CelmkPK67zuCgpdlF4EA==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz", + "integrity": "sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/visitor-keys": "5.11.0" + "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/visitor-keys": "5.12.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1938,12 +1946,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.11.0.tgz", - "integrity": "sha512-wDqdsYO6ofLaD4DsGZ0jGwxp4HrzD2YKulpEZXmgN3xo4BHJwf7kq49JTRpV0Gx6bxkSUmc9s0EIK1xPbFFpIA==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz", + "integrity": "sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.11.0", + "@typescript-eslint/utils": "5.12.0", "debug": "^4.3.2", "tsutils": "^3.21.0" }, @@ -1964,9 +1972,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.11.0.tgz", - "integrity": "sha512-cxgBFGSRCoBEhvSVLkKw39+kMzUKHlJGVwwMbPcTZX3qEhuXhrjwaZXWMxVfxDgyMm+b5Q5b29Llo2yow8Y7xQ==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.0.tgz", + "integrity": "sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1977,13 +1985,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.11.0.tgz", - "integrity": "sha512-yVH9hKIv3ZN3lw8m/Jy5I4oXO4ZBMqijcXCdA4mY8ull6TPTAoQnKKrcZ0HDXg7Bsl0Unwwx7jcXMuNZc0m4lg==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz", + "integrity": "sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/visitor-keys": "5.11.0", + "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/visitor-keys": "5.12.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -2024,15 +2032,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.11.0.tgz", - "integrity": "sha512-g2I480tFE1iYRDyMhxPAtLQ9HAn0jjBtipgTCZmd9I9s11OV8CTsG+YfFciuNDcHqm4csbAgC2aVZCHzLxMSUw==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.0.tgz", + "integrity": "sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/typescript-estree": "5.11.0", + "@typescript-eslint/scope-manager": "5.12.0", + "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/typescript-estree": "5.12.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -2048,12 +2056,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.11.0.tgz", - "integrity": "sha512-E8w/vJReMGuloGxJDkpPlGwhxocxOpSVgSvjiLO5IxZPmxZF30weOeJYyPSEACwM+X4NziYS9q+WkN/2DHYQwA==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz", + "integrity": "sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.11.0", + "@typescript-eslint/types": "5.12.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -3566,9 +3574,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001309", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001309.tgz", - "integrity": "sha512-Pl8vfigmBXXq+/yUz1jUwULeq9xhMJznzdc/xwl4WclDAuebcTHVefpz8lE/bMI+UN7TOkSSe7B7RnZd6+dzjA==", + "version": "1.0.30001312", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz", + "integrity": "sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ==", "dev": true, "funding": { "type": "opencollective", @@ -3844,9 +3852,9 @@ "dev": true }, "node_modules/clinic": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/clinic/-/clinic-11.0.0.tgz", - "integrity": "sha512-5AO9sIloFSA5eDP+5A+sov4L3qHNeVHGLxqBLWWEKrhPxYSht4IjcoidifudQYmm8+An+1l4uoQ9NwX/c7AkJQ==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/clinic/-/clinic-11.1.0.tgz", + "integrity": "sha512-Bd7fsqqCK1epYxLsruiOenLfzkQVMmaVMn2oVPXsi18DFKBBFmmCYLOdtCPsqxQed4hTxWIrZl9WZIt7R74eyA==", "dev": true, "dependencies": { "@clinic/bubbleprof": "^8.0.0", @@ -3874,7 +3882,7 @@ "clinic": "bin.js" }, "engines": { - "node": ">= 12.13.0" + "node": ">= 12.22.7" } }, "node_modules/clipboard-copy": { @@ -4039,6 +4047,8 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true, + "optional": true, "engines": { "node": ">=0.1.90" } @@ -5449,9 +5459,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.66", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.66.tgz", - "integrity": "sha512-f1RXFMsvwufWLwYUxTiP7HmjprKXrqEWHiQkjAYa9DJeVIlZk5v8gBGcaV+FhtXLly6C1OTVzQY+2UQrACiLlg==", + "version": "1.4.71", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.71.tgz", + "integrity": "sha512-Hk61vXXKRb2cd3znPE9F+2pLWdIOmP7GjiTj45y6L3W/lO+hSnUSUhq+6lEaERWBdZOHbk2s3YV5c9xVl3boVw==", "dev": true }, "node_modules/elliptic": { @@ -5790,12 +5800,12 @@ } }, "node_modules/eslint": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.8.0.tgz", - "integrity": "sha512-H3KXAzQGBH1plhYS3okDix2ZthuYJlQQEGE5k0IKuEqUSiyu4AmxxlJ2MtTYeJ3xB4jDhcYCwGOg2TXYdnDXlQ==", + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.9.0.tgz", + "integrity": "sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.0.5", + "@eslint/eslintrc": "^1.1.0", "@humanwhocodes/config-array": "^0.9.2", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -5803,10 +5813,10 @@ "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.0", + "eslint-scope": "^7.1.1", "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.2.0", - "espree": "^9.3.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -6013,12 +6023,12 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "37.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.8.0.tgz", - "integrity": "sha512-0HvNH9nyKhp06u5vi8lPB97j/luBrkk+6JrcKVBjLQZuVkyzLYfKOYoc9cFHxMKvJMgYVa2F3g+msV2T8IM3jQ==", + "version": "37.9.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.9.2.tgz", + "integrity": "sha512-2VnY8fzFX2BsP3sHDeF1V6hacEUjt/tpq1JBo4PYeYyIJWTy3KsmCqDgs5Yqrfw0cbtFRyHTHN8ELbH7X4ctmg==", "dev": true, "dependencies": { - "@es-joy/jsdoccomment": "~0.18.0", + "@es-joy/jsdoccomment": "~0.20.0", "comment-parser": "1.3.0", "debug": "^4.3.3", "escape-string-regexp": "^4.0.0", @@ -6128,9 +6138,9 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz", - "integrity": "sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -6153,9 +6163,9 @@ } }, "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz", - "integrity": "sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", @@ -6189,14 +6199,14 @@ } }, "node_modules/espree": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.0.tgz", - "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==", + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", + "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", "dev": true, "dependencies": { "acorn": "^8.7.0", "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^3.1.0" + "eslint-visitor-keys": "^3.3.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -9699,9 +9709,9 @@ "devOptional": true }, "node_modules/jsdoc-type-pratt-parser": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.2.2.tgz", - "integrity": "sha512-zRokSWcPLSWkoNzsWn9pq7YYSwDhKyEe+cJYT2qaPqLOOJb5sFSi46BPj81vP+e8chvCNdQL9RG86Bi9EI6MDw==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.2.3.tgz", + "integrity": "sha512-QPyxq62Q8veBSDtDrWmqaEPjSCeknUV9dH/OAGt3q9an8qC8UQDqitQiw1NvoMskIESpoRZ6qzt4H3rlK0xo8A==", "dev": true, "engines": { "node": ">=12.0.0" @@ -10289,22 +10299,17 @@ } }, "node_modules/logform": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/logform/-/logform-2.3.2.tgz", - "integrity": "sha512-V6JiPThZzTsbVRspNO6TmHkR99oqYTs8fivMBYQkjZj6rxW92KxtDCPE6IkAk1DNBnYKNkjm4jYBm6JDUcyhOA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.4.0.tgz", + "integrity": "sha512-CPSJw4ftjf517EhXZGGvTHHkYobo7ZCc0kvwUoOYcjfR2UVrI66RHj8MCrfAdEitdmFqbu2BYdYs8FHHZSb6iw==", "dependencies": { - "colors": "1.4.0", + "@colors/colors": "1.5.0", "fecha": "^4.2.0", "ms": "^2.1.1", - "safe-stable-stringify": "^1.1.0", + "safe-stable-stringify": "^2.3.1", "triple-beam": "^1.3.0" } }, - "node_modules/logform/node_modules/safe-stable-stringify": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz", - "integrity": "sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==" - }, "node_modules/long": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", @@ -10474,9 +10479,9 @@ } }, "node_modules/mariadb/node_modules/@types/node": { - "version": "14.18.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.10.tgz", - "integrity": "sha512-6iihJ/Pp5fsFJ/aEDGyvT4pHGmCpq7ToQ/yf4bl5SbVAvwpspYJ+v3jO7n8UyjhQVHTy+KNszOozDdv+O6sovQ==" + "version": "14.18.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz", + "integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A==" }, "node_modules/mariadb/node_modules/iconv-lite": { "version": "0.6.3", @@ -14905,9 +14910,9 @@ } }, "node_modules/release-it/node_modules/rxjs": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.3.tgz", - "integrity": "sha512-6162iC/N7L7K8q3UvdOMWix1ju+esADGrDaPrTu5XJmCv69YNdYoUaop/iatN8GHK+YHOdszPP+qygA0yi04zQ==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.4.tgz", + "integrity": "sha512-h5M3Hk78r6wAheJF0a5YahB1yRQKCsZ4MsGdZ5O9ETbVtjPcScGfrMmoOq7EBsCRzd4BDkvDJ7ogP8Sz5tTFiQ==", "dev": true, "dependencies": { "tslib": "^2.1.0" @@ -15314,9 +15319,9 @@ } }, "node_modules/rollup": { - "version": "2.67.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.67.1.tgz", - "integrity": "sha512-1Sbcs4OuW+aD+hhqpIRl+RqooIpF6uQcfzU/QSI7vGkwADY6cM4iLsBGRM2CGLXDTDN5y/yShohFmnKegSPWzg==", + "version": "2.67.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.67.2.tgz", + "integrity": "sha512-hoEiBWwZtf1QdK3jZIq59L0FJj4Fiv4RplCO4pvCRC86qsoFurWB4hKQIjoRf3WvJmk5UZ9b0y5ton+62fC7Tw==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -18636,29 +18641,29 @@ } }, "node_modules/winston": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.5.1.tgz", - "integrity": "sha512-tbRtVy+vsSSCLcZq/8nXZaOie/S2tPXPFt4be/Q3vI/WtYwm7rrwidxVw2GRa38FIXcJ1kUM6MOZ9Jmnk3F3UA==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.6.0.tgz", + "integrity": "sha512-9j8T75p+bcN6D00sF/zjFVmPp+t8KMPB1MzbbzYjeN9VWxdsYnTB40TkbNUEXAmILEfChMvAMgidlX64OG3p6w==", "dependencies": { "@dabh/diagnostics": "^2.0.2", "async": "^3.2.3", "is-stream": "^2.0.0", - "logform": "^2.3.2", + "logform": "^2.4.0", "one-time": "^1.0.0", "readable-stream": "^3.4.0", "safe-stable-stringify": "^2.3.1", "stack-trace": "0.0.x", "triple-beam": "^1.3.0", - "winston-transport": "^4.4.2" + "winston-transport": "^4.5.0" }, "engines": { - "node": ">= 6.4.0" + "node": ">= 12.0.0" } }, "node_modules/winston-daily-rotate-file": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/winston-daily-rotate-file/-/winston-daily-rotate-file-4.6.0.tgz", - "integrity": "sha512-mvpFb1LYmTvh/vz0dIS/aDCwEm0cvDa8D/tE4xWwdUYolD250wf+n0y1PZ2xr7fbvTLF/PQYqXtFIFrmog03Ow==", + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/winston-daily-rotate-file/-/winston-daily-rotate-file-4.6.1.tgz", + "integrity": "sha512-Ycch4LZmTycbhgiI2eQXBKI1pKcEQgAqmBjyq7/dC6Dk77nasdxvhLKraqTdCw7wNDSs8/M0jXaLATHquG7xYg==", "dependencies": { "file-stream-rotator": "^0.6.1", "object-hash": "^2.0.1", @@ -18666,7 +18671,7 @@ "winston-transport": "^4.4.0" }, "engines": { - "node": ">=12" + "node": ">=8" }, "peerDependencies": { "winston": "^3" @@ -19085,18 +19090,18 @@ }, "dependencies": { "@ampproject/remapping": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.1.0.tgz", - "integrity": "sha512-d5RysTlJ7hmw5Tw4UxgxcY3lkMe92n8sXCcuLPAyIAHK6j8DefDwtGnVVDgOnv+RnEosulDJ9NPKQL27bDId0g==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.1.2.tgz", + "integrity": "sha512-hoyByceqwKirw7w3Z7gnIIZC3Wx3J484Y3L/cMpXFbr7d9ZQj2mODrirNzcJa+SM3UlpWXYvKV4RlRpFXlWgXg==", "dev": true, "requires": { "@jridgewell/trace-mapping": "^0.3.0" } }, "@assemblyscript/loader": { - "version": "0.19.22", - "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.19.22.tgz", - "integrity": "sha512-ksrMVpPOatD7ZzXCw+c/g3zId5rm8MMnQe7P32dH/qtDrgT9SbQjJYEngRP0YhRF0qrBCga2PtpID7arqphGyg==", + "version": "0.19.23", + "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.19.23.tgz", + "integrity": "sha512-ulkCYfFbYj01ie1MDOyxv2F6SpRN1TOj7fQxbP07D6HmeR+gr2JLSmINKjga2emB+b1L2KGrFKBTc+e00p54nw==", "dev": true }, "@babel/code-frame": { @@ -19115,20 +19120,20 @@ "dev": true }, "@babel/core": { - "version": "7.17.2", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.2.tgz", - "integrity": "sha512-R3VH5G42VSDolRHyUO4V2cfag8WHcZyxdq5Z/m8Xyb92lW/Erm/6kM+XtRFGf3Mulre3mveni2NHfEUws8wSvw==", + "version": "7.17.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.4.tgz", + "integrity": "sha512-R9x5r4t4+hBqZTmioSnkrW+I6NmbojwjGT8p4G2Gw1thWbXIHGDnmGdLdFw0/7ljucdIrNRp7Npgb4CyBYzzJg==", "dev": true, "requires": { - "@ampproject/remapping": "^2.0.0", + "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.0", + "@babel/generator": "^7.17.3", "@babel/helper-compilation-targets": "^7.16.7", "@babel/helper-module-transforms": "^7.16.7", "@babel/helpers": "^7.17.2", - "@babel/parser": "^7.17.0", + "@babel/parser": "^7.17.3", "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.0", + "@babel/traverse": "^7.17.3", "@babel/types": "^7.17.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", @@ -19161,9 +19166,9 @@ } }, "@babel/generator": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.0.tgz", - "integrity": "sha512-I3Omiv6FGOC29dtlZhkfXO6pgkmukJSlT26QjVvS1DGZe/NzSVCPG41X0tS21oZkJYlovfj9qDWgKP+Cn4bXxw==", + "version": "7.17.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.3.tgz", + "integrity": "sha512-+R6Dctil/MgUsZsZAkYgK+ADNSZzJRRy0TvY65T71z/CR854xHQ1EweBYXdfT+HNeN7w0cSJJEzgxZMv40pxsg==", "dev": true, "requires": { "@babel/types": "^7.17.0", @@ -19365,9 +19370,9 @@ } }, "@babel/parser": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.0.tgz", - "integrity": "sha512-VKXSCQx5D8S04ej+Dqsr1CzYvvWgf20jIw2D+YhQCrIlr2UZGaDds23Y0xg75/skOxpLCRpUZvk/1EAVkGoDOw==", + "version": "7.17.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.3.tgz", + "integrity": "sha512-7yJPvPV+ESz2IUTPbOL+YkIGyCqOyNIzdguKQuJGnH7bg1WTIifuM21YqokFt/THWh1AkCRn9IgoykTRCBVpzA==", "dev": true }, "@babel/template": { @@ -19382,18 +19387,18 @@ } }, "@babel/traverse": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.0.tgz", - "integrity": "sha512-fpFIXvqD6kC7c7PUNnZ0Z8cQXlarCLtCUpt2S1Dx7PjoRtCFffvOkHHSom+m5HIxMZn5bIBVb71lhabcmjEsqg==", + "version": "7.17.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.3.tgz", + "integrity": "sha512-5irClVky7TxRWIRtxlh2WPUUOLhcPN06AGgaQSB8AEwuyEBgJVuJ5imdHm5zxk8w0QS5T+tDfnDxAlhWjpb7cw==", "dev": true, "requires": { "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.0", + "@babel/generator": "^7.17.3", "@babel/helper-environment-visitor": "^7.16.7", "@babel/helper-function-name": "^7.16.7", "@babel/helper-hoist-variables": "^7.16.7", "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.17.0", + "@babel/parser": "^7.17.3", "@babel/types": "^7.17.0", "debug": "^4.1.0", "globals": "^11.1.0" @@ -19564,6 +19569,11 @@ "turbo-json-parse": "^2.2.0" } }, + "@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==" + }, "@cspotcode/source-map-consumer": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", @@ -19580,9 +19590,9 @@ } }, "@dabh/diagnostics": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz", - "integrity": "sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz", + "integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==", "requires": { "colorspace": "1.1.x", "enabled": "2.0.x", @@ -19590,25 +19600,25 @@ } }, "@es-joy/jsdoccomment": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.18.0.tgz", - "integrity": "sha512-TjT8KJULV4I6ZiwIoKr6eMs+XpRejqwJ/VA+QPDeFGe9j6bZFKmMJ81EeFsGm6JNZhnzm37aoxVROmTh2PZoyA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.20.0.tgz", + "integrity": "sha512-uiNBw8wxbmXHxRlQJnzO5336F/CKsHD/Kp+J1ISuLA8LFBTKUjBEcOxZdXQTI+yhen4Lx5Qv9KbN6+FAMtkEVg==", "dev": true, "requires": { "comment-parser": "1.3.0", "esquery": "^1.4.0", - "jsdoc-type-pratt-parser": "~2.2.2" + "jsdoc-type-pratt-parser": "~2.2.3" } }, "@eslint/eslintrc": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz", - "integrity": "sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.1.0.tgz", + "integrity": "sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.2.0", + "espree": "^9.3.1", "globals": "^13.9.0", "ignore": "^4.0.6", "import-fresh": "^3.2.1", @@ -19790,21 +19800,21 @@ } }, "@jridgewell/resolve-uri": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.4.tgz", - "integrity": "sha512-cz8HFjOFfUBtvN+NXYSFMHYRdxZMaEl0XypVrhzxBgadKIXhIkRd8aMeHhmF56Sl7SuS8OnUpQ73/k9LE4VnLg==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz", + "integrity": "sha512-VPeQ7+wH0itvQxnG+lIzWgkysKIr3L9sslimFW55rHMdGu/qCQ5z5h9zq4gI8uBtqkpHhsF4Z/OwExufUCThew==", "dev": true }, "@jridgewell/sourcemap-codec": { - "version": "1.4.10", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.10.tgz", - "integrity": "sha512-Ht8wIW5v165atIX1p+JvKR5ONzUyF4Ac8DZIQ5kZs9zrb6M8SJNXpx1zn04rn65VjBMygRoMXcyYwNK0fT7bEg==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz", + "integrity": "sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg==", "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.2.tgz", - "integrity": "sha512-9KzzH4kMjA2XmBRHfqG2/Vtl7s92l6uNDd0wW7frDE+EUvQFGqNXhWp0UGJjSkt3v2AYjzOZn1QO9XaTNJIt1Q==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.4.tgz", + "integrity": "sha512-vFv9ttIedivx0ux3QSjhgtCVjPZd5l46ZOMDSCwnH1yUO2e964gO8LZGyv2QkqcgR6TnBU1v+1IFqmeoG+0UJQ==", "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", @@ -19812,9 +19822,9 @@ } }, "@mdn/browser-compat-data": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-4.1.6.tgz", - "integrity": "sha512-JbtcHGODAlkOT6eDV2rCyOguW3+o34ExMD9DOki6kxzeyN3IBtZ9PI0FlbKeD77Bm5U0UG5Heo4qnNbSajXUnw==", + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-4.1.8.tgz", + "integrity": "sha512-iY8qGU+yJvscccvWLyWPKfF9BSLmSFth5HBNjSNtIfoyUrQV3lTZml+zyKWRymMYCgvos6LiSqMj1RDEj3TehA==", "dev": true }, "@mikro-orm/cli": { @@ -20348,9 +20358,9 @@ } }, "@types/node": { - "version": "16.11.22", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.22.tgz", - "integrity": "sha512-DYNtJWauMQ9RNpesl4aVothr97/tIJM8HbyOXJ0AYT1Z2bEjLHyfjOBPAQQVMLf8h3kSShYfNk8Wnto8B2zHUA==" + "version": "16.11.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.25.tgz", + "integrity": "sha512-NrTwfD7L1RTc2qrHQD4RTTy4p0CO2LatKBEKEds3CaVuhoM/+DJzmWZl5f+ikR8cm8F5mfJxK+9rQq07gRiSjQ==" }, "@types/object-path": { "version": "0.11.1", @@ -20507,14 +20517,14 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.11.0.tgz", - "integrity": "sha512-HJh33bgzXe6jGRocOj4FmefD7hRY4itgjzOrSs3JPrTNXsX7j5+nQPciAUj/1nZtwo2kAc3C75jZO+T23gzSGw==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz", + "integrity": "sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/type-utils": "5.11.0", - "@typescript-eslint/utils": "5.11.0", + "@typescript-eslint/scope-manager": "5.12.0", + "@typescript-eslint/type-utils": "5.12.0", + "@typescript-eslint/utils": "5.12.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -20524,52 +20534,52 @@ } }, "@typescript-eslint/parser": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.11.0.tgz", - "integrity": "sha512-x0DCjetHZYBRovJdr3U0zG9OOdNXUaFLJ82ehr1AlkArljJuwEsgnud+Q7umlGDFLFrs8tU8ybQDFocp/eX8mQ==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.12.0.tgz", + "integrity": "sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/typescript-estree": "5.11.0", + "@typescript-eslint/scope-manager": "5.12.0", + "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/typescript-estree": "5.12.0", "debug": "^4.3.2" } }, "@typescript-eslint/scope-manager": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.11.0.tgz", - "integrity": "sha512-z+K4LlahDFVMww20t/0zcA7gq/NgOawaLuxgqGRVKS0PiZlCTIUtX0EJbC0BK1JtR4CelmkPK67zuCgpdlF4EA==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz", + "integrity": "sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/visitor-keys": "5.11.0" + "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/visitor-keys": "5.12.0" } }, "@typescript-eslint/type-utils": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.11.0.tgz", - "integrity": "sha512-wDqdsYO6ofLaD4DsGZ0jGwxp4HrzD2YKulpEZXmgN3xo4BHJwf7kq49JTRpV0Gx6bxkSUmc9s0EIK1xPbFFpIA==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz", + "integrity": "sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.11.0", + "@typescript-eslint/utils": "5.12.0", "debug": "^4.3.2", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.11.0.tgz", - "integrity": "sha512-cxgBFGSRCoBEhvSVLkKw39+kMzUKHlJGVwwMbPcTZX3qEhuXhrjwaZXWMxVfxDgyMm+b5Q5b29Llo2yow8Y7xQ==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.0.tgz", + "integrity": "sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.11.0.tgz", - "integrity": "sha512-yVH9hKIv3ZN3lw8m/Jy5I4oXO4ZBMqijcXCdA4mY8ull6TPTAoQnKKrcZ0HDXg7Bsl0Unwwx7jcXMuNZc0m4lg==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz", + "integrity": "sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/visitor-keys": "5.11.0", + "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/visitor-keys": "5.12.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -20594,26 +20604,26 @@ } }, "@typescript-eslint/utils": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.11.0.tgz", - "integrity": "sha512-g2I480tFE1iYRDyMhxPAtLQ9HAn0jjBtipgTCZmd9I9s11OV8CTsG+YfFciuNDcHqm4csbAgC2aVZCHzLxMSUw==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.0.tgz", + "integrity": "sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/typescript-estree": "5.11.0", + "@typescript-eslint/scope-manager": "5.12.0", + "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/typescript-estree": "5.12.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/visitor-keys": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.11.0.tgz", - "integrity": "sha512-E8w/vJReMGuloGxJDkpPlGwhxocxOpSVgSvjiLO5IxZPmxZF30weOeJYyPSEACwM+X4NziYS9q+WkN/2DHYQwA==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz", + "integrity": "sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.11.0", + "@typescript-eslint/types": "5.12.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -21817,9 +21827,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001309", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001309.tgz", - "integrity": "sha512-Pl8vfigmBXXq+/yUz1jUwULeq9xhMJznzdc/xwl4WclDAuebcTHVefpz8lE/bMI+UN7TOkSSe7B7RnZd6+dzjA==", + "version": "1.0.30001312", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz", + "integrity": "sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ==", "dev": true }, "capture-stack-trace": { @@ -22026,9 +22036,9 @@ "dev": true }, "clinic": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/clinic/-/clinic-11.0.0.tgz", - "integrity": "sha512-5AO9sIloFSA5eDP+5A+sov4L3qHNeVHGLxqBLWWEKrhPxYSht4IjcoidifudQYmm8+An+1l4uoQ9NwX/c7AkJQ==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/clinic/-/clinic-11.1.0.tgz", + "integrity": "sha512-Bd7fsqqCK1epYxLsruiOenLfzkQVMmaVMn2oVPXsi18DFKBBFmmCYLOdtCPsqxQed4hTxWIrZl9WZIt7R74eyA==", "dev": true, "requires": { "@clinic/bubbleprof": "^8.0.0", @@ -22182,7 +22192,9 @@ "colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true, + "optional": true }, "colorspace": { "version": "1.1.4", @@ -23379,9 +23391,9 @@ } }, "electron-to-chromium": { - "version": "1.4.66", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.66.tgz", - "integrity": "sha512-f1RXFMsvwufWLwYUxTiP7HmjprKXrqEWHiQkjAYa9DJeVIlZk5v8gBGcaV+FhtXLly6C1OTVzQY+2UQrACiLlg==", + "version": "1.4.71", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.71.tgz", + "integrity": "sha512-Hk61vXXKRb2cd3znPE9F+2pLWdIOmP7GjiTj45y6L3W/lO+hSnUSUhq+6lEaERWBdZOHbk2s3YV5c9xVl3boVw==", "dev": true }, "elliptic": { @@ -23672,12 +23684,12 @@ } }, "eslint": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.8.0.tgz", - "integrity": "sha512-H3KXAzQGBH1plhYS3okDix2ZthuYJlQQEGE5k0IKuEqUSiyu4AmxxlJ2MtTYeJ3xB4jDhcYCwGOg2TXYdnDXlQ==", + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.9.0.tgz", + "integrity": "sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.0.5", + "@eslint/eslintrc": "^1.1.0", "@humanwhocodes/config-array": "^0.9.2", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -23685,10 +23697,10 @@ "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.0", + "eslint-scope": "^7.1.1", "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.2.0", - "espree": "^9.3.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -23727,9 +23739,9 @@ } }, "eslint-scope": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz", - "integrity": "sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", "dev": true, "requires": { "esrecurse": "^4.3.0", @@ -23894,12 +23906,12 @@ } }, "eslint-plugin-jsdoc": { - "version": "37.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.8.0.tgz", - "integrity": "sha512-0HvNH9nyKhp06u5vi8lPB97j/luBrkk+6JrcKVBjLQZuVkyzLYfKOYoc9cFHxMKvJMgYVa2F3g+msV2T8IM3jQ==", + "version": "37.9.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.9.2.tgz", + "integrity": "sha512-2VnY8fzFX2BsP3sHDeF1V6hacEUjt/tpq1JBo4PYeYyIJWTy3KsmCqDgs5Yqrfw0cbtFRyHTHN8ELbH7X4ctmg==", "dev": true, "requires": { - "@es-joy/jsdoccomment": "~0.18.0", + "@es-joy/jsdoccomment": "~0.20.0", "comment-parser": "1.3.0", "debug": "^4.3.3", "escape-string-regexp": "^4.0.0", @@ -23974,9 +23986,9 @@ } }, "eslint-visitor-keys": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz", - "integrity": "sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", "dev": true }, "esm": { @@ -23985,14 +23997,14 @@ "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==" }, "espree": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.0.tgz", - "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==", + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", + "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", "dev": true, "requires": { "acorn": "^8.7.0", "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^3.1.0" + "eslint-visitor-keys": "^3.3.0" } }, "esprima": { @@ -26721,9 +26733,9 @@ "devOptional": true }, "jsdoc-type-pratt-parser": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.2.2.tgz", - "integrity": "sha512-zRokSWcPLSWkoNzsWn9pq7YYSwDhKyEe+cJYT2qaPqLOOJb5sFSi46BPj81vP+e8chvCNdQL9RG86Bi9EI6MDw==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.2.3.tgz", + "integrity": "sha512-QPyxq62Q8veBSDtDrWmqaEPjSCeknUV9dH/OAGt3q9an8qC8UQDqitQiw1NvoMskIESpoRZ6qzt4H3rlK0xo8A==", "dev": true }, "jsesc": { @@ -27182,22 +27194,15 @@ } }, "logform": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/logform/-/logform-2.3.2.tgz", - "integrity": "sha512-V6JiPThZzTsbVRspNO6TmHkR99oqYTs8fivMBYQkjZj6rxW92KxtDCPE6IkAk1DNBnYKNkjm4jYBm6JDUcyhOA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.4.0.tgz", + "integrity": "sha512-CPSJw4ftjf517EhXZGGvTHHkYobo7ZCc0kvwUoOYcjfR2UVrI66RHj8MCrfAdEitdmFqbu2BYdYs8FHHZSb6iw==", "requires": { - "colors": "1.4.0", + "@colors/colors": "1.5.0", "fecha": "^4.2.0", "ms": "^2.1.1", - "safe-stable-stringify": "^1.1.0", + "safe-stable-stringify": "^2.3.1", "triple-beam": "^1.3.0" - }, - "dependencies": { - "safe-stable-stringify": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz", - "integrity": "sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==" - } } }, "long": { @@ -27332,9 +27337,9 @@ }, "dependencies": { "@types/node": { - "version": "14.18.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.10.tgz", - "integrity": "sha512-6iihJ/Pp5fsFJ/aEDGyvT4pHGmCpq7ToQ/yf4bl5SbVAvwpspYJ+v3jO7n8UyjhQVHTy+KNszOozDdv+O6sovQ==" + "version": "14.18.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz", + "integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A==" }, "iconv-lite": { "version": "0.6.3", @@ -30866,9 +30871,9 @@ } }, "rxjs": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.3.tgz", - "integrity": "sha512-6162iC/N7L7K8q3UvdOMWix1ju+esADGrDaPrTu5XJmCv69YNdYoUaop/iatN8GHK+YHOdszPP+qygA0yi04zQ==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.4.tgz", + "integrity": "sha512-h5M3Hk78r6wAheJF0a5YahB1yRQKCsZ4MsGdZ5O9ETbVtjPcScGfrMmoOq7EBsCRzd4BDkvDJ7ogP8Sz5tTFiQ==", "dev": true, "requires": { "tslib": "^2.1.0" @@ -31180,9 +31185,9 @@ } }, "rollup": { - "version": "2.67.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.67.1.tgz", - "integrity": "sha512-1Sbcs4OuW+aD+hhqpIRl+RqooIpF6uQcfzU/QSI7vGkwADY6cM4iLsBGRM2CGLXDTDN5y/yShohFmnKegSPWzg==", + "version": "2.67.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.67.2.tgz", + "integrity": "sha512-hoEiBWwZtf1QdK3jZIq59L0FJj4Fiv4RplCO4pvCRC86qsoFurWB4hKQIjoRf3WvJmk5UZ9b0y5ton+62fC7Tw==", "dev": true, "requires": { "fsevents": "~2.3.2" @@ -33807,20 +33812,20 @@ } }, "winston": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.5.1.tgz", - "integrity": "sha512-tbRtVy+vsSSCLcZq/8nXZaOie/S2tPXPFt4be/Q3vI/WtYwm7rrwidxVw2GRa38FIXcJ1kUM6MOZ9Jmnk3F3UA==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.6.0.tgz", + "integrity": "sha512-9j8T75p+bcN6D00sF/zjFVmPp+t8KMPB1MzbbzYjeN9VWxdsYnTB40TkbNUEXAmILEfChMvAMgidlX64OG3p6w==", "requires": { "@dabh/diagnostics": "^2.0.2", "async": "^3.2.3", "is-stream": "^2.0.0", - "logform": "^2.3.2", + "logform": "^2.4.0", "one-time": "^1.0.0", "readable-stream": "^3.4.0", "safe-stable-stringify": "^2.3.1", "stack-trace": "0.0.x", "triple-beam": "^1.3.0", - "winston-transport": "^4.4.2" + "winston-transport": "^4.5.0" }, "dependencies": { "readable-stream": { @@ -33836,9 +33841,9 @@ } }, "winston-daily-rotate-file": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/winston-daily-rotate-file/-/winston-daily-rotate-file-4.6.0.tgz", - "integrity": "sha512-mvpFb1LYmTvh/vz0dIS/aDCwEm0cvDa8D/tE4xWwdUYolD250wf+n0y1PZ2xr7fbvTLF/PQYqXtFIFrmog03Ow==", + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/winston-daily-rotate-file/-/winston-daily-rotate-file-4.6.1.tgz", + "integrity": "sha512-Ycch4LZmTycbhgiI2eQXBKI1pKcEQgAqmBjyq7/dC6Dk77nasdxvhLKraqTdCw7wNDSs8/M0jXaLATHquG7xYg==", "requires": { "file-stream-rotator": "^0.6.1", "object-hash": "^2.0.1", diff --git a/package.json b/package.json index f63198f2..ebeb1881 100644 --- a/package.json +++ b/package.json @@ -80,8 +80,8 @@ "tar": "^6.1.11", "tslib": "^2.3.1", "uuid": "^8.3.2", - "winston": "^3.5.1", - "winston-daily-rotate-file": "^4.6.0", + "winston": "^3.6.0", + "winston-daily-rotate-file": "^4.6.1", "ws": "^8.5.0" }, "optionalDependencies": { @@ -94,19 +94,19 @@ "@rollup/plugin-json": "^4.1.0", "@types/mocha": "^9.1.0", "@types/mochawesome": "^6.2.1", - "@types/node": "^16.11.22", + "@types/node": "^16.11.25", "@types/proper-lockfile": "^4.1.2", "@types/tar": "^6.1.1", "@types/uuid": "^8.3.4", "@types/ws": "^8.2.2", - "@typescript-eslint/eslint-plugin": "^5.11.0", - "@typescript-eslint/parser": "^5.11.0", + "@typescript-eslint/eslint-plugin": "^5.12.0", + "@typescript-eslint/parser": "^5.12.0", "auto-changelog": "^2.4.0", - "clinic": "^11.0.0", + "clinic": "^11.1.0", "cross-env": "^7.0.3", - "eslint": "^8.8.0", + "eslint": "^8.9.0", "eslint-plugin-import": "^2.25.4", - "eslint-plugin-jsdoc": "^37.8.0", + "eslint-plugin-jsdoc": "^37.9.2", "eslint-plugin-node": "^11.1.0", "expect": "^27.5.1", "mocha": "^9.2.0", @@ -115,7 +115,7 @@ "nyc": "^15.1.0", "release-it": "^14.12.4", "robohydra": "^0.6.9", - "rollup": "^2.67.1", + "rollup": "^2.67.2", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-delete": "^2.0.0", diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index dddfc045..1d753a01 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -7,7 +7,7 @@ import Constants from '../utils/Constants'; import PerformanceStatistics from '../performance/PerformanceStatistics'; import { Status } from '../types/AutomaticTransactionGenerator'; import Utils from '../utils/Utils'; -import logger from '../utils/Logger'; +import getLogger from '../utils/Logger'; export default class AutomaticTransactionGenerator { public started: boolean; @@ -23,7 +23,7 @@ export default class AutomaticTransactionGenerator { public start(): void { if (this.started) { - logger.error(`${this.logPrefix()} trying to start while already started`); + getLogger().error(`${this.logPrefix()} trying to start while already started`); return; } this.startConnectors(); @@ -32,7 +32,7 @@ export default class AutomaticTransactionGenerator { public stop(): void { if (!this.started) { - logger.error(`${this.logPrefix()} trying to stop while not started`); + getLogger().error(`${this.logPrefix()} trying to stop while not started`); return; } this.stopConnectors(); @@ -60,36 +60,36 @@ export default class AutomaticTransactionGenerator { private async internalStartConnector(connectorId: number): Promise { this.initStartConnectorStatus(connectorId); - logger.info(this.logPrefix(connectorId) + ' started on connector and will run for ' + Utils.formatDurationMilliSeconds(this.connectorsStatus.get(connectorId).stopDate.getTime() - this.connectorsStatus.get(connectorId).startDate.getTime())); + getLogger().info(this.logPrefix(connectorId) + ' started on connector and will run for ' + Utils.formatDurationMilliSeconds(this.connectorsStatus.get(connectorId).stopDate.getTime() - this.connectorsStatus.get(connectorId).startDate.getTime())); while (this.connectorsStatus.get(connectorId).start) { if ((new Date()) > this.connectorsStatus.get(connectorId).stopDate) { this.stopConnector(connectorId); break; } if (!this.chargingStation.isInAcceptedState()) { - logger.error(this.logPrefix(connectorId) + ' entered in transaction loop while the charging station is not in accepted state'); + getLogger().error(this.logPrefix(connectorId) + ' entered in transaction loop while the charging station is not in accepted state'); this.stopConnector(connectorId); break; } if (!this.chargingStation.isChargingStationAvailable()) { - logger.info(this.logPrefix(connectorId) + ' entered in transaction loop while the charging station is unavailable'); + getLogger().info(this.logPrefix(connectorId) + ' entered in transaction loop while the charging station is unavailable'); this.stopConnector(connectorId); break; } if (!this.chargingStation.isConnectorAvailable(connectorId)) { - logger.info(`${this.logPrefix(connectorId)} entered in transaction loop while the connector ${connectorId} is unavailable`); + getLogger().info(`${this.logPrefix(connectorId)} entered in transaction loop while the connector ${connectorId} is unavailable`); this.stopConnector(connectorId); break; } if (!this.chargingStation?.ocppRequestService) { - logger.info(`${this.logPrefix(connectorId)} transaction loop waiting for charging station service to be initialized`); + getLogger().info(`${this.logPrefix(connectorId)} transaction loop waiting for charging station service to be initialized`); do { await Utils.sleep(Constants.CHARGING_STATION_ATG_INITIALIZATION_TIME); } while (!this.chargingStation?.ocppRequestService); } const wait = Utils.getRandomInteger(this.chargingStation.stationInfo.AutomaticTransactionGenerator.maxDelayBetweenTwoTransactions, this.chargingStation.stationInfo.AutomaticTransactionGenerator.minDelayBetweenTwoTransactions) * 1000; - logger.info(this.logPrefix(connectorId) + ' waiting for ' + Utils.formatDurationMilliSeconds(wait)); + getLogger().info(this.logPrefix(connectorId) + ' waiting for ' + Utils.formatDurationMilliSeconds(wait)); await Utils.sleep(wait); const start = Utils.secureRandom(); if (start < this.chargingStation.stationInfo.AutomaticTransactionGenerator.probabilityOfStart) { @@ -98,30 +98,30 @@ export default class AutomaticTransactionGenerator { const startResponse = await this.startTransaction(connectorId); this.connectorsStatus.get(connectorId).startTransactionRequests++; if (startResponse?.idTagInfo?.status !== AuthorizationStatus.ACCEPTED) { - logger.warn(this.logPrefix(connectorId) + ' start transaction rejected'); + getLogger().warn(this.logPrefix(connectorId) + ' start transaction rejected'); this.connectorsStatus.get(connectorId).rejectedStartTransactionRequests++; } else { // Wait until end of transaction const waitTrxEnd = Utils.getRandomInteger(this.chargingStation.stationInfo.AutomaticTransactionGenerator.maxDuration, this.chargingStation.stationInfo.AutomaticTransactionGenerator.minDuration) * 1000; - logger.info(this.logPrefix(connectorId) + ' transaction ' + this.chargingStation.getConnectorStatus(connectorId).transactionId.toString() + ' started and will stop in ' + Utils.formatDurationMilliSeconds(waitTrxEnd)); + getLogger().info(this.logPrefix(connectorId) + ' transaction ' + this.chargingStation.getConnectorStatus(connectorId).transactionId.toString() + ' started and will stop in ' + Utils.formatDurationMilliSeconds(waitTrxEnd)); this.connectorsStatus.get(connectorId).acceptedStartTransactionRequests++; await Utils.sleep(waitTrxEnd); // Stop transaction - logger.info(this.logPrefix(connectorId) + ' stop transaction ' + this.chargingStation.getConnectorStatus(connectorId).transactionId.toString()); + getLogger().info(this.logPrefix(connectorId) + ' stop transaction ' + this.chargingStation.getConnectorStatus(connectorId).transactionId.toString()); await this.stopTransaction(connectorId); } } else { this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions++; this.connectorsStatus.get(connectorId).skippedTransactions++; - logger.info(this.logPrefix(connectorId) + ' skipped consecutively ' + this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions.toString() + '/' + this.connectorsStatus.get(connectorId).skippedTransactions.toString() + ' transaction(s)'); + getLogger().info(this.logPrefix(connectorId) + ' skipped consecutively ' + this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions.toString() + '/' + this.connectorsStatus.get(connectorId).skippedTransactions.toString() + ' transaction(s)'); } this.connectorsStatus.get(connectorId).lastRunDate = new Date(); } await this.stopTransaction(connectorId); this.connectorsStatus.get(connectorId).stoppedDate = new Date(); - logger.info(this.logPrefix(connectorId) + ' stopped on connector and lasted for ' + Utils.formatDurationMilliSeconds(this.connectorsStatus.get(connectorId).stoppedDate.getTime() - this.connectorsStatus.get(connectorId).startDate.getTime())); - logger.debug(`${this.logPrefix(connectorId)} connector status %j`, this.connectorsStatus.get(connectorId)); + getLogger().info(this.logPrefix(connectorId) + ' stopped on connector and lasted for ' + Utils.formatDurationMilliSeconds(this.connectorsStatus.get(connectorId).stoppedDate.getTime() - this.connectorsStatus.get(connectorId).startDate.getTime())); + getLogger().debug(`${this.logPrefix(connectorId)} connector status %j`, this.connectorsStatus.get(connectorId)); } private startConnector(connectorId: number): void { @@ -167,7 +167,7 @@ export default class AutomaticTransactionGenerator { this.connectorsStatus.get(connectorId).authorizeRequests++; if (authorizeResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { this.connectorsStatus.get(connectorId).acceptedAuthorizeRequests++; - logger.info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag); + getLogger().info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag); // Start transaction startResponse = await this.chargingStation.ocppRequestService.sendStartTransaction(connectorId, idTag); PerformanceStatistics.endMeasure(measureId, beginId); @@ -177,13 +177,13 @@ export default class AutomaticTransactionGenerator { PerformanceStatistics.endMeasure(measureId, beginId); return authorizeResponse; } - logger.info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag); + getLogger().info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag); // Start transaction startResponse = await this.chargingStation.ocppRequestService.sendStartTransaction(connectorId, idTag); PerformanceStatistics.endMeasure(measureId, beginId); return startResponse; } - logger.info(this.logPrefix(connectorId) + ' start transaction without an idTag'); + getLogger().info(this.logPrefix(connectorId) + ' start transaction without an idTag'); startResponse = await this.chargingStation.ocppRequestService.sendStartTransaction(connectorId); PerformanceStatistics.endMeasure(measureId, beginId); return startResponse; @@ -202,7 +202,7 @@ export default class AutomaticTransactionGenerator { reason); this.connectorsStatus.get(connectorId).stopTransactionRequests++; } else { - logger.warn(`${this.logPrefix(connectorId)} trying to stop a not started transaction${transactionId ? ' ' + transactionId.toString() : ''}`); + getLogger().warn(`${this.logPrefix(connectorId)} trying to stop a not started transaction${transactionId ? ' ' + transactionId.toString() : ''}`); } PerformanceStatistics.endMeasure(measureId, beginId); return stopResponse; diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 84756ab7..1e10118b 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -37,7 +37,7 @@ import { URL } from 'url'; import Utils from '../utils/Utils'; import crypto from 'crypto'; import fs from 'fs'; -import logger from '../utils/Logger'; +import getLogger from '../utils/Logger'; import { parentPort } from 'worker_threads'; import path from 'path'; @@ -184,7 +184,7 @@ export default class ChargingStation { defaultVoltageOut = Voltage.VOLTAGE_400; break; default: - logger.error(errMsg); + getLogger().error(errMsg); throw new Error(errMsg); } return !Utils.isUndefined(this.stationInfo.voltageOut) ? this.stationInfo.voltageOut : defaultVoltageOut; @@ -264,17 +264,17 @@ export default class ChargingStation { public getSampledValueTemplate(connectorId: number, measurand: MeterValueMeasurand = MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER, phase?: MeterValuePhase): SampledValueTemplate | undefined { if (!Constants.SUPPORTED_MEASURANDS.includes(measurand)) { - logger.warn(`${this.logPrefix()} Trying to get unsupported MeterValues measurand '${measurand}' ${phase ? `on phase ${phase} ` : ''}in template on connectorId ${connectorId}`); + getLogger().warn(`${this.logPrefix()} Trying to get unsupported MeterValues measurand '${measurand}' ${phase ? `on phase ${phase} ` : ''}in template on connectorId ${connectorId}`); return; } if (measurand !== MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER && !this.getConfigurationKey(StandardParametersKey.MeterValuesSampledData).value.includes(measurand)) { - logger.debug(`${this.logPrefix()} Trying to get MeterValues measurand '${measurand}' ${phase ? `on phase ${phase} ` : ''}in template on connectorId ${connectorId} not found in '${StandardParametersKey.MeterValuesSampledData}' OCPP parameter`); + getLogger().debug(`${this.logPrefix()} Trying to get MeterValues measurand '${measurand}' ${phase ? `on phase ${phase} ` : ''}in template on connectorId ${connectorId} not found in '${StandardParametersKey.MeterValuesSampledData}' OCPP parameter`); return; } const sampledValueTemplates: SampledValueTemplate[] = this.getConnectorStatus(connectorId).MeterValues; for (let index = 0; !Utils.isEmptyArray(sampledValueTemplates) && index < sampledValueTemplates.length; index++) { if (!Constants.SUPPORTED_MEASURANDS.includes(sampledValueTemplates[index]?.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER)) { - logger.warn(`${this.logPrefix()} Unsupported MeterValues measurand '${measurand}' ${phase ? `on phase ${phase} ` : ''}in template on connectorId ${connectorId}`); + getLogger().warn(`${this.logPrefix()} Unsupported MeterValues measurand '${measurand}' ${phase ? `on phase ${phase} ` : ''}in template on connectorId ${connectorId}`); } else if (phase && sampledValueTemplates[index]?.phase === phase && sampledValueTemplates[index]?.measurand === measurand && this.getConfigurationKey(StandardParametersKey.MeterValuesSampledData).value.includes(measurand)) { return sampledValueTemplates[index]; @@ -288,10 +288,10 @@ export default class ChargingStation { } if (measurand === MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER) { const errorMsg = `${this.logPrefix()} Missing MeterValues for default measurand '${measurand}' in template on connectorId ${connectorId}`; - logger.error(errorMsg); + getLogger().error(errorMsg); throw new Error(errorMsg); } - logger.debug(`${this.logPrefix()} No MeterValues for measurand '${measurand}' ${phase ? `on phase ${phase} ` : ''}in template on connectorId ${connectorId}`); + getLogger().debug(`${this.logPrefix()} No MeterValues for measurand '${measurand}' ${phase ? `on phase ${phase} ` : ''}in template on connectorId ${connectorId}`); } public getAutomaticTransactionGeneratorRequireAuthorize(): boolean { @@ -304,11 +304,11 @@ export default class ChargingStation { this.heartbeatSetInterval = setInterval(async (): Promise => { await this.ocppRequestService.sendHeartbeat(); }, this.getHeartbeatInterval()); - logger.info(this.logPrefix() + ' Heartbeat started every ' + Utils.formatDurationMilliSeconds(this.getHeartbeatInterval())); + getLogger().info(this.logPrefix() + ' Heartbeat started every ' + Utils.formatDurationMilliSeconds(this.getHeartbeatInterval())); } else if (this.heartbeatSetInterval) { - logger.info(this.logPrefix() + ' Heartbeat already started every ' + Utils.formatDurationMilliSeconds(this.getHeartbeatInterval())); + getLogger().info(this.logPrefix() + ' Heartbeat already started every ' + Utils.formatDurationMilliSeconds(this.getHeartbeatInterval())); } else { - logger.error(`${this.logPrefix()} Heartbeat interval set to ${this.getHeartbeatInterval() ? Utils.formatDurationMilliSeconds(this.getHeartbeatInterval()) : this.getHeartbeatInterval()}, not starting the heartbeat`); + getLogger().error(`${this.logPrefix()} Heartbeat interval set to ${this.getHeartbeatInterval() ? Utils.formatDurationMilliSeconds(this.getHeartbeatInterval()) : this.getHeartbeatInterval()}, not starting the heartbeat`); } } @@ -321,18 +321,18 @@ export default 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()}`); + getLogger().error(`${this.logPrefix()} Trying to start MeterValues on connector Id ${connectorId.toString()}`); return; } if (!this.getConnectorStatus(connectorId)) { - logger.error(`${this.logPrefix()} Trying to start MeterValues on non existing connector Id ${connectorId.toString()}`); + getLogger().error(`${this.logPrefix()} Trying to start MeterValues on non existing connector Id ${connectorId.toString()}`); return; } if (!this.getConnectorStatus(connectorId)?.transactionStarted) { - logger.error(`${this.logPrefix()} Trying to start MeterValues on connector Id ${connectorId} with no transaction started`); + getLogger().error(`${this.logPrefix()} Trying to start MeterValues on connector Id ${connectorId} with no transaction started`); return; } else if (this.getConnectorStatus(connectorId)?.transactionStarted && !this.getConnectorStatus(connectorId)?.transactionId) { - logger.error(`${this.logPrefix()} Trying to start MeterValues on connector Id ${connectorId} with no transaction id`); + getLogger().error(`${this.logPrefix()} Trying to start MeterValues on connector Id ${connectorId} with no transaction id`); return; } if (interval > 0) { @@ -341,7 +341,7 @@ export default class ChargingStation { await this.ocppRequestService.sendMeterValues(connectorId, this.getConnectorStatus(connectorId).transactionId, interval); }, interval); } else { - logger.error(`${this.logPrefix()} Charging station ${StandardParametersKey.MeterValueSampleInterval} configuration set to ${interval ? Utils.formatDurationMilliSeconds(interval) : interval}, not sending MeterValues`); + getLogger().error(`${this.logPrefix()} Charging station ${StandardParametersKey.MeterValueSampleInterval} configuration set to ${interval ? Utils.formatDurationMilliSeconds(interval) : interval}, not sending MeterValues`); } } @@ -412,7 +412,7 @@ export default class ChargingStation { reboot, }); } else { - logger.error(`${this.logPrefix()} Trying to add an already existing configuration key: %j`, keyFound); + getLogger().error(`${this.logPrefix()} Trying to add an already existing configuration key: %j`, keyFound); } } @@ -422,7 +422,7 @@ export default class ChargingStation { const keyIndex = this.configuration.configurationKey.indexOf(keyFound); this.configuration.configurationKey[keyIndex].value = value; } else { - logger.error(`${this.logPrefix()} Trying to set a value on a non existing configuration key: %j`, { key, value }); + getLogger().error(`${this.logPrefix()} Trying to set a value on a non existing configuration key: %j`, { key, value }); } } @@ -520,7 +520,7 @@ export default class ChargingStation { private handleUnsupportedVersion(version: OCPPVersion) { const errMsg = `${this.logPrefix()} Unsupported protocol version '${version}' configured in template file ${this.stationTemplateFile}`; - logger.error(errMsg); + getLogger().error(errMsg); throw new Error(errMsg); } @@ -537,18 +537,18 @@ export default class ChargingStation { // Build connectors if needed const maxConnectors = this.getMaxNumberOfConnectors(); if (maxConnectors <= 0) { - logger.warn(`${this.logPrefix()} Charging station template ${this.stationTemplateFile} with ${maxConnectors} connectors`); + getLogger().warn(`${this.logPrefix()} Charging station template ${this.stationTemplateFile} with ${maxConnectors} connectors`); } const templateMaxConnectors = this.getTemplateMaxNumberOfConnectors(); if (templateMaxConnectors <= 0) { - logger.warn(`${this.logPrefix()} Charging station template ${this.stationTemplateFile} with no connector configuration`); + getLogger().warn(`${this.logPrefix()} Charging station template ${this.stationTemplateFile} with no connector configuration`); } if (!this.stationInfo.Connectors[0]) { - logger.warn(`${this.logPrefix()} Charging station template ${this.stationTemplateFile} with no connector Id 0 configuration`); + getLogger().warn(`${this.logPrefix()} Charging station template ${this.stationTemplateFile} with no connector Id 0 configuration`); } // Sanity check if (maxConnectors > (this.stationInfo.Connectors[0] ? templateMaxConnectors - 1 : templateMaxConnectors) && !this.stationInfo.randomConnectors) { - logger.warn(`${this.logPrefix()} Number of connectors exceeds the number of connector configurations in template ${this.stationTemplateFile}, forcing random connector configurations affectation`); + getLogger().warn(`${this.logPrefix()} Number of connectors exceeds the number of connector configurations in template ${this.stationTemplateFile}, forcing random connector configurations affectation`); this.stationInfo.randomConnectors = true; } const connectorsConfigHash = crypto.createHash('sha256').update(JSON.stringify(this.stationInfo.Connectors) + maxConnectors.toString()).digest('hex'); @@ -654,7 +654,7 @@ export default class ChargingStation { } private async onOpen(): Promise { - logger.info(`${this.logPrefix()} Connected to OCPP server through ${this.wsConnectionUrl.toString()}`); + getLogger().info(`${this.logPrefix()} Connected to OCPP server through ${this.wsConnectionUrl.toString()}`); if (!this.isInAcceptedState()) { // Send BootNotification let registrationRetryCount = 0; @@ -674,7 +674,7 @@ export default class ChargingStation { this.flushMessageBuffer(); } } else { - logger.error(`${this.logPrefix()} Registration failure: max retries reached (${this.getRegistrationMaxRetries()}) or retry disabled (${this.getRegistrationMaxRetries()})`); + getLogger().error(`${this.logPrefix()} Registration failure: max retries reached (${this.getRegistrationMaxRetries()}) or retry disabled (${this.getRegistrationMaxRetries()})`); } this.autoReconnectRetryCount = 0; this.wsConnectionRestarted = false; @@ -685,12 +685,12 @@ export default class ChargingStation { // Normal close case WebSocketCloseEventStatusCode.CLOSE_NORMAL: case WebSocketCloseEventStatusCode.CLOSE_NO_STATUS: - logger.info(`${this.logPrefix()} WebSocket normally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}' and reason '${reason}'`); + getLogger().info(`${this.logPrefix()} WebSocket normally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}' and reason '${reason}'`); this.autoReconnectRetryCount = 0; break; // Abnormal close default: - logger.error(`${this.logPrefix()} WebSocket abnormally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}' and reason '${reason}'`); + getLogger().error(`${this.logPrefix()} WebSocket abnormally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}' and reason '${reason}'`); await this.reconnect(code); break; } @@ -754,27 +754,27 @@ export default class ChargingStation { // Error default: errMsg = `${this.logPrefix()} Wrong message type ${messageType}`; - logger.error(errMsg); + getLogger().error(errMsg); throw new OCPPError(ErrorType.PROTOCOL_ERROR, errMsg); } } catch (error) { // Log - logger.error('%s Incoming OCPP message %j matching cached request %j processing error %j', this.logPrefix(), data.toString(), this.requests.get(messageId), error); + getLogger().error('%s Incoming OCPP message %j matching cached request %j processing error %j', this.logPrefix(), data.toString(), this.requests.get(messageId), error); // Send error messageType === MessageType.CALL_MESSAGE && await this.ocppRequestService.sendError(messageId, error as OCPPError, commandName); } } private onPing(): void { - logger.debug(this.logPrefix() + ' Received a WS ping (rfc6455) from the server'); + getLogger().debug(this.logPrefix() + ' Received a WS ping (rfc6455) from the server'); } private onPong(): void { - logger.debug(this.logPrefix() + ' Received a WS pong (rfc6455) from the server'); + getLogger().debug(this.logPrefix() + ' Received a WS pong (rfc6455) from the server'); } private async onError(error: WSError): Promise { - logger.error(this.logPrefix() + ' WebSocket error: %j', error); + getLogger().error(this.logPrefix() + ' WebSocket error: %j', error); // switch (error.code) { // case 'ECONNREFUSED': // await this.reconnect(error); @@ -803,7 +803,7 @@ export default class ChargingStation { FileUtils.handleFileException(this.logPrefix(), 'Authorization', authorizationFile, error as NodeJS.ErrnoException); } } else { - logger.info(this.logPrefix() + ' No authorization file given in template file ' + this.stationTemplateFile); + getLogger().info(this.logPrefix() + ' No authorization file given in template file ' + this.stationTemplateFile); } return authorizedTags; } @@ -951,11 +951,11 @@ export default class ChargingStation { this.wsConnection.ping((): void => { /* This is intentional */ }); } }, webSocketPingInterval * 1000); - logger.info(this.logPrefix() + ' WebSocket ping started every ' + Utils.formatDurationSeconds(webSocketPingInterval)); + getLogger().info(this.logPrefix() + ' WebSocket ping started every ' + Utils.formatDurationSeconds(webSocketPingInterval)); } else if (this.webSocketPingSetInterval) { - logger.info(this.logPrefix() + ' WebSocket ping every ' + Utils.formatDurationSeconds(webSocketPingInterval) + ' already started'); + getLogger().info(this.logPrefix() + ' WebSocket ping every ' + Utils.formatDurationSeconds(webSocketPingInterval) + ' already started'); } else { - logger.error(`${this.logPrefix()} WebSocket ping interval set to ${webSocketPingInterval ? Utils.formatDurationSeconds(webSocketPingInterval) : webSocketPingInterval}, not starting the WebSocket ping`); + getLogger().error(`${this.logPrefix()} WebSocket ping interval set to ${webSocketPingInterval ? Utils.formatDurationSeconds(webSocketPingInterval) : webSocketPingInterval}, not starting the WebSocket ping`); } } @@ -967,7 +967,7 @@ export default class ChargingStation { private warnDeprecatedTemplateKey(template: ChargingStationTemplate, key: string, chargingStationId: string, logMsgToAppend = ''): void { if (!Utils.isUndefined(template[key])) { - logger.warn(`${Utils.logPrefix(` ${chargingStationId} |`)} Deprecated template key '${key}' usage in file '${this.stationTemplateFile}'${logMsgToAppend && '. ' + logMsgToAppend}`); + getLogger().warn(`${Utils.logPrefix(` ${chargingStationId} |`)} Deprecated template key '${key}' usage in file '${this.stationTemplateFile}'${logMsgToAppend && '. ' + logMsgToAppend}`); } } @@ -995,11 +995,11 @@ export default class ChargingStation { if (this.index <= supervisionUrls.length) { urlIndex = this.index - 1; } else { - logger.warn(`${this.logPrefix()} No more configured supervision urls available, using the first one`); + getLogger().warn(`${this.logPrefix()} No more configured supervision urls available, using the first one`); } break; default: - logger.error(`${this.logPrefix()} Unknown supervision url distribution '${Configuration.getSupervisionUrlDistribution()}' from values '${SupervisionUrlDistribution.toString()}', defaulting to ${SupervisionUrlDistribution.ROUND_ROBIN}`); + getLogger().error(`${this.logPrefix()} Unknown supervision url distribution '${Configuration.getSupervisionUrlDistribution()}' from values '${SupervisionUrlDistribution.toString()}', defaulting to ${SupervisionUrlDistribution.ROUND_ROBIN}`); urlIndex = (this.index - 1) % supervisionUrls.length; break; } @@ -1017,7 +1017,7 @@ export default class ChargingStation { if (HeartBeatInterval) { return Utils.convertToInt(HeartBeatInterval.value) * 1000; } - !this.stationInfo.autoRegister && logger.warn(`${this.logPrefix()} Heartbeat interval configuration key not set, using default value: ${Constants.DEFAULT_HEARTBEAT_INTERVAL}`); + !this.stationInfo.autoRegister && getLogger().warn(`${this.logPrefix()} Heartbeat interval configuration key not set, using default value: ${Constants.DEFAULT_HEARTBEAT_INTERVAL}`); return Constants.DEFAULT_HEARTBEAT_INTERVAL; } @@ -1045,7 +1045,7 @@ export default class ChargingStation { break; } this.wsConnection = new WebSocket(this.wsConnectionUrl, protocol, options); - logger.info(this.logPrefix() + ' Open OCPP connection to URL ' + this.wsConnectionUrl.toString()); + getLogger().info(this.logPrefix() + ' Open OCPP connection to URL ' + this.wsConnectionUrl.toString()); } private stopMeterValues(connectorId: number) { @@ -1061,11 +1061,11 @@ export default class ChargingStation { fs.watch(authorizationFile, (event, filename) => { if (filename && event === 'change') { try { - logger.debug(this.logPrefix() + ' Authorization file ' + authorizationFile + ' have changed, reload'); + getLogger().debug(this.logPrefix() + ' Authorization file ' + authorizationFile + ' have changed, reload'); // Initialize authorizedTags this.authorizedTags = this.getAuthorizedTags(); } catch (error) { - logger.error(this.logPrefix() + ' Authorization file monitoring error: %j', error); + getLogger().error(this.logPrefix() + ' Authorization file monitoring error: %j', error); } } }); @@ -1073,7 +1073,7 @@ export default class ChargingStation { FileUtils.handleFileException(this.logPrefix(), 'Authorization', authorizationFile, error as NodeJS.ErrnoException); } } else { - logger.info(this.logPrefix() + ' No authorization file given in template file ' + this.stationTemplateFile + '. Not monitoring changes'); + getLogger().info(this.logPrefix() + ' No authorization file given in template file ' + this.stationTemplateFile + '. Not monitoring changes'); } } @@ -1082,7 +1082,7 @@ export default class ChargingStation { fs.watch(this.stationTemplateFile, (event, filename): void => { if (filename && event === 'change') { try { - logger.debug(this.logPrefix() + ' Template file ' + this.stationTemplateFile + ' have changed, reload'); + getLogger().debug(this.logPrefix() + ' Template file ' + this.stationTemplateFile + ' have changed, reload'); // Initialize this.initialize(); // Restart the ATG @@ -1098,7 +1098,7 @@ export default class ChargingStation { } // FIXME?: restart heartbeat and WebSocket ping when their interval values have changed } catch (error) { - logger.error(this.logPrefix() + ' Charging station template file monitoring error: %j', error); + getLogger().error(this.logPrefix() + ' Charging station template file monitoring error: %j', error); } } }); @@ -1127,13 +1127,13 @@ export default class ChargingStation { this.autoReconnectRetryCount++; const reconnectDelay = (this.getReconnectExponentialDelay() ? Utils.exponentialDelay(this.autoReconnectRetryCount) : this.getConnectionTimeout() * 1000); const reconnectTimeout = (reconnectDelay - 100) > 0 && reconnectDelay; - logger.error(`${this.logPrefix()} WebSocket: connection retry in ${Utils.roundTo(reconnectDelay, 2)}ms, timeout ${reconnectTimeout}ms`); + getLogger().error(`${this.logPrefix()} WebSocket: connection retry in ${Utils.roundTo(reconnectDelay, 2)}ms, timeout ${reconnectTimeout}ms`); await Utils.sleep(reconnectDelay); - logger.error(this.logPrefix() + ' WebSocket: reconnecting try #' + this.autoReconnectRetryCount.toString()); + getLogger().error(this.logPrefix() + ' WebSocket: reconnecting try #' + this.autoReconnectRetryCount.toString()); this.openWSConnection({ ...this.stationInfo.wsOptions, handshakeTimeout: reconnectTimeout }, true); this.wsConnectionRestarted = true; } else if (this.getAutoReconnectMaxRetries() !== -1) { - logger.error(`${this.logPrefix()} WebSocket reconnect failure: max retries reached (${this.autoReconnectRetryCount}) or retry disabled (${this.getAutoReconnectMaxRetries()})`); + getLogger().error(`${this.logPrefix()} WebSocket reconnect failure: max retries reached (${this.autoReconnectRetryCount}) or retry disabled (${this.getAutoReconnectMaxRetries()})`); } } diff --git a/src/charging-station/UIWebSocketServer.ts b/src/charging-station/UIWebSocketServer.ts index 96e9a968..a8990763 100644 --- a/src/charging-station/UIWebSocketServer.ts +++ b/src/charging-station/UIWebSocketServer.ts @@ -7,7 +7,7 @@ import Configuration from '../utils/Configuration'; import { IncomingMessage } from 'http'; import UIServiceFactory from './ui-websocket-services/UIServiceFactory'; import Utils from '../utils/Utils'; -import logger from '../utils/Logger'; +import getLogger from '../utils/Logger'; export default class UIWebSocketServer extends Server { public readonly chargingStations: Set; @@ -48,11 +48,11 @@ export default class UIWebSocketServer extends Server { throw new BaseError('UI protocol request is not iterable'); } this.uiServices.get(version).handleMessage(command, payload).catch(() => { - logger.error(`${this.logPrefix()} Error while handling command %s message: %j`, command, payload); + getLogger().error(`${this.logPrefix()} Error while handling command %s message: %j`, command, payload); }); }); socket.on('error', (error) => { - logger.error(`${this.logPrefix()} Error on WebSocket: %j`, error); + getLogger().error(`${this.logPrefix()} Error on WebSocket: %j`, error); }); }); } diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index c9f9042f..aa0eff46 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -21,7 +21,7 @@ import OCPPIncomingRequestService from '../OCPPIncomingRequestService'; import { URL } from 'url'; import Utils from '../../../utils/Utils'; import fs from 'fs'; -import logger from '../../../utils/Logger'; +import getLogger from '../../../utils/Logger'; import path from 'path'; import tar from 'tar'; @@ -59,7 +59,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer result = await this.incomingRequestHandlers.get(commandName)(commandPayload); } catch (error) { // Log - logger.error(this.chargingStation.logPrefix() + ' Handle request error: %j', error); + getLogger().error(this.chargingStation.logPrefix() + ' Handle request error: %j', error); throw error; } } else { @@ -81,7 +81,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer await Utils.sleep(this.chargingStation.stationInfo.resetTime); this.chargingStation.start(); }); - logger.info(`${this.chargingStation.logPrefix()} ${commandPayload.type} reset command received, simulating it. The station will be back online in ${Utils.formatDurationMilliSeconds(this.chargingStation.stationInfo.resetTime)}`); + getLogger().info(`${this.chargingStation.logPrefix()} ${commandPayload.type} reset command received, simulating it. The station will be back online in ${Utils.formatDurationMilliSeconds(this.chargingStation.stationInfo.resetTime)}`); return Constants.OCPP_RESPONSE_ACCEPTED; } @@ -92,7 +92,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer private async handleRequestUnlockConnector(commandPayload: UnlockConnectorRequest): Promise { const connectorId = commandPayload.connectorId; if (connectorId === 0) { - logger.error(this.chargingStation.logPrefix() + ' Trying to unlock connector ' + connectorId.toString()); + getLogger().error(this.chargingStation.logPrefix() + ' Trying to unlock connector ' + connectorId.toString()); return Constants.OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED; } if (this.chargingStation.getConnectorStatus(connectorId)?.transactionStarted) { @@ -157,10 +157,10 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer private handleRequestChangeConfiguration(commandPayload: ChangeConfigurationRequest): ChangeConfigurationResponse { // JSON request fields type sanity check if (!Utils.isString(commandPayload.key)) { - logger.error(`${this.chargingStation.logPrefix()} ${OCPP16RequestCommand.CHANGE_CONFIGURATION} request key field is not a string:`, commandPayload); + getLogger().error(`${this.chargingStation.logPrefix()} ${OCPP16RequestCommand.CHANGE_CONFIGURATION} request key field is not a string:`, commandPayload); } if (!Utils.isString(commandPayload.value)) { - logger.error(`${this.chargingStation.logPrefix()} ${OCPP16RequestCommand.CHANGE_CONFIGURATION} request value field is not a string:`, commandPayload); + getLogger().error(`${this.chargingStation.logPrefix()} ${OCPP16RequestCommand.CHANGE_CONFIGURATION} request value field is not a string:`, commandPayload); } const keyToChange = this.chargingStation.getConfigurationKey(commandPayload.key, true); if (!keyToChange) { @@ -198,7 +198,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer private handleRequestSetChargingProfile(commandPayload: SetChargingProfileRequest): SetChargingProfileResponse { if (!this.chargingStation.getConnectorStatus(commandPayload.connectorId)) { - logger.error(`${this.chargingStation.logPrefix()} Trying to set charging profile(s) to a non existing connector Id ${commandPayload.connectorId}`); + getLogger().error(`${this.chargingStation.logPrefix()} Trying to set charging profile(s) to a non existing connector Id ${commandPayload.connectorId}`); return Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED; } if (commandPayload.csChargingProfiles.chargingProfilePurpose === ChargingProfilePurposeType.CHARGE_POINT_MAX_PROFILE && commandPayload.connectorId !== 0) { @@ -208,18 +208,18 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer return Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED; } this.chargingStation.setChargingProfile(commandPayload.connectorId, commandPayload.csChargingProfiles); - logger.debug(`${this.chargingStation.logPrefix()} Charging profile(s) set, dump their stack: %j`, this.chargingStation.getConnectorStatus(commandPayload.connectorId).chargingProfiles); + getLogger().debug(`${this.chargingStation.logPrefix()} Charging profile(s) set, dump their stack: %j`, this.chargingStation.getConnectorStatus(commandPayload.connectorId).chargingProfiles); return Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED; } private handleRequestClearChargingProfile(commandPayload: ClearChargingProfileRequest): ClearChargingProfileResponse { if (!this.chargingStation.getConnectorStatus(commandPayload.connectorId)) { - logger.error(`${this.chargingStation.logPrefix()} Trying to clear a charging profile(s) to a non existing connector Id ${commandPayload.connectorId}`); + getLogger().error(`${this.chargingStation.logPrefix()} Trying to clear a charging profile(s) to a non existing connector Id ${commandPayload.connectorId}`); return Constants.OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN; } if (commandPayload.connectorId && !Utils.isEmptyArray(this.chargingStation.getConnectorStatus(commandPayload.connectorId).chargingProfiles)) { this.chargingStation.getConnectorStatus(commandPayload.connectorId).chargingProfiles = []; - logger.debug(`${this.chargingStation.logPrefix()} Charging profile(s) cleared, dump their stack: %j`, this.chargingStation.getConnectorStatus(commandPayload.connectorId).chargingProfiles); + getLogger().debug(`${this.chargingStation.logPrefix()} Charging profile(s) cleared, dump their stack: %j`, this.chargingStation.getConnectorStatus(commandPayload.connectorId).chargingProfiles); return Constants.OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED; } if (!commandPayload.connectorId) { @@ -242,7 +242,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer } if (clearCurrentCP) { this.chargingStation.getConnectorStatus(commandPayload.connectorId).chargingProfiles[index] = {} as OCPP16ChargingProfile; - logger.debug(`${this.chargingStation.logPrefix()} Charging profile(s) cleared, dump their stack: %j`, this.chargingStation.getConnectorStatus(commandPayload.connectorId).chargingProfiles); + getLogger().debug(`${this.chargingStation.logPrefix()} Charging profile(s) cleared, dump their stack: %j`, this.chargingStation.getConnectorStatus(commandPayload.connectorId).chargingProfiles); clearedCP = true; } }); @@ -258,7 +258,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer private async handleRequestChangeAvailability(commandPayload: ChangeAvailabilityRequest): Promise { const connectorId: number = commandPayload.connectorId; if (!this.chargingStation.getConnectorStatus(connectorId)) { - logger.error(`${this.chargingStation.logPrefix()} Trying to change the availability of a non existing connector Id ${connectorId.toString()}`); + getLogger().error(`${this.chargingStation.logPrefix()} Trying to change the availability of a non existing connector Id ${connectorId.toString()}`); return Constants.OCPP_AVAILABILITY_RESPONSE_REJECTED; } const chargePointStatus: OCPP16ChargePointStatus = commandPayload.type === OCPP16AvailabilityType.OPERATIVE @@ -310,14 +310,14 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer authorized = true; } } else { - logger.warn(`${this.chargingStation.logPrefix()} The charging station configuration expects authorize at remote start transaction but local authorization or authorize isn't enabled`); + getLogger().warn(`${this.chargingStation.logPrefix()} The charging station configuration expects authorize at remote start transaction but local authorization or authorize isn't enabled`); } if (authorized) { // Authorization successful, start transaction if (this.setRemoteStartTransactionChargingProfile(transactionConnectorId, commandPayload.chargingProfile)) { this.chargingStation.getConnectorStatus(transactionConnectorId).transactionRemoteStarted = true; if ((await this.chargingStation.ocppRequestService.sendStartTransaction(transactionConnectorId, commandPayload.idTag)).idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED) { - logger.debug(this.chargingStation.logPrefix() + ' Transaction remotely STARTED on ' + this.chargingStation.stationInfo.chargingStationId + '#' + transactionConnectorId.toString() + ' for idTag ' + commandPayload.idTag); + getLogger().debug(this.chargingStation.logPrefix() + ' Transaction remotely STARTED on ' + this.chargingStation.stationInfo.chargingStationId + '#' + transactionConnectorId.toString() + ' for idTag ' + commandPayload.idTag); return Constants.OCPP_RESPONSE_ACCEPTED; } return this.notifyRemoteStartTransactionRejected(transactionConnectorId, commandPayload.idTag); @@ -330,7 +330,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer if (this.setRemoteStartTransactionChargingProfile(transactionConnectorId, commandPayload.chargingProfile)) { this.chargingStation.getConnectorStatus(transactionConnectorId).transactionRemoteStarted = true; if ((await this.chargingStation.ocppRequestService.sendStartTransaction(transactionConnectorId, commandPayload.idTag)).idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED) { - logger.debug(this.chargingStation.logPrefix() + ' Transaction remotely STARTED on ' + this.chargingStation.stationInfo.chargingStationId + '#' + transactionConnectorId.toString() + ' for idTag ' + commandPayload.idTag); + getLogger().debug(this.chargingStation.logPrefix() + ' Transaction remotely STARTED on ' + this.chargingStation.stationInfo.chargingStationId + '#' + transactionConnectorId.toString() + ' for idTag ' + commandPayload.idTag); return Constants.OCPP_RESPONSE_ACCEPTED; } return this.notifyRemoteStartTransactionRejected(transactionConnectorId, commandPayload.idTag); @@ -347,17 +347,17 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer await this.chargingStation.ocppRequestService.sendStatusNotification(connectorId, OCPP16ChargePointStatus.AVAILABLE); this.chargingStation.getConnectorStatus(connectorId).status = OCPP16ChargePointStatus.AVAILABLE; } - logger.warn(this.chargingStation.logPrefix() + ' Remote starting transaction REJECTED on connector Id ' + connectorId.toString() + ', idTag ' + idTag + ', availability ' + this.chargingStation.getConnectorStatus(connectorId).availability + ', status ' + this.chargingStation.getConnectorStatus(connectorId).status); + getLogger().warn(this.chargingStation.logPrefix() + ' Remote starting transaction REJECTED on connector Id ' + connectorId.toString() + ', idTag ' + idTag + ', availability ' + this.chargingStation.getConnectorStatus(connectorId).availability + ', status ' + this.chargingStation.getConnectorStatus(connectorId).status); return Constants.OCPP_RESPONSE_REJECTED; } private setRemoteStartTransactionChargingProfile(connectorId: number, cp: OCPP16ChargingProfile): boolean { if (cp && cp.chargingProfilePurpose === ChargingProfilePurposeType.TX_PROFILE) { this.chargingStation.setChargingProfile(connectorId, cp); - logger.debug(`${this.chargingStation.logPrefix()} Charging profile(s) set at remote start transaction, dump their stack: %j`, this.chargingStation.getConnectorStatus(connectorId).chargingProfiles); + getLogger().debug(`${this.chargingStation.logPrefix()} Charging profile(s) set at remote start transaction, dump their stack: %j`, this.chargingStation.getConnectorStatus(connectorId).chargingProfiles); return true; } else if (cp && cp.chargingProfilePurpose !== ChargingProfilePurposeType.TX_PROFILE) { - logger.warn(`${this.chargingStation.logPrefix()} Not allowed to set ${cp.chargingProfilePurpose} charging profile(s) at remote start transaction`); + getLogger().warn(`${this.chargingStation.logPrefix()} Not allowed to set ${cp.chargingProfilePurpose} charging profile(s) at remote start transaction`); return false; } else if (!cp) { return true; @@ -375,12 +375,12 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer return Constants.OCPP_RESPONSE_ACCEPTED; } } - logger.info(this.chargingStation.logPrefix() + ' Trying to remote stop a non existing transaction ' + transactionId.toString()); + getLogger().info(this.chargingStation.logPrefix() + ' Trying to remote stop a non existing transaction ' + transactionId.toString()); return Constants.OCPP_RESPONSE_REJECTED; } private async handleRequestGetDiagnostics(commandPayload: GetDiagnosticsRequest): Promise { - logger.debug(this.chargingStation.logPrefix() + ' ' + OCPP16IncomingRequestCommand.GET_DIAGNOSTICS + ' request received: %j', commandPayload); + getLogger().debug(this.chargingStation.logPrefix() + ' ' + OCPP16IncomingRequestCommand.GET_DIAGNOSTICS + ' request received: %j', commandPayload); const uri = new URL(commandPayload.location); if (uri.protocol.startsWith('ftp:')) { let ftpClient: Client; @@ -399,7 +399,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer if (accessResponse.code === 220) { // eslint-disable-next-line @typescript-eslint/no-misused-promises ftpClient.trackProgress(async (info) => { - logger.info(`${this.chargingStation.logPrefix()} ${info.bytes / 1024} bytes transferred from diagnostics archive ${info.name}`); + getLogger().info(`${this.chargingStation.logPrefix()} ${info.bytes / 1024} bytes transferred from diagnostics archive ${info.name}`); await this.chargingStation.ocppRequestService.sendDiagnosticsStatusNotification(OCPP16DiagnosticsStatus.Uploading); }); uploadResponse = await ftpClient.uploadFrom(path.join(path.resolve(__dirname, '../../../../'), diagnosticsArchive), uri.pathname + diagnosticsArchive); @@ -421,7 +421,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer return this.handleIncomingRequestError(OCPP16IncomingRequestCommand.GET_DIAGNOSTICS, error as Error, Constants.OCPP_RESPONSE_EMPTY); } } else { - logger.error(`${this.chargingStation.logPrefix()} Unsupported protocol ${uri.protocol} to transfer the diagnostic logs archive`); + getLogger().error(`${this.chargingStation.logPrefix()} Unsupported protocol ${uri.protocol} to transfer the diagnostic logs archive`); await this.chargingStation.ocppRequestService.sendDiagnosticsStatusNotification(OCPP16DiagnosticsStatus.UploadFailed); return Constants.OCPP_RESPONSE_EMPTY; } diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index 3580cc52..b4a17cd4 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -21,7 +21,7 @@ import OCPPError from '../../../exception/OCPPError'; import OCPPRequestService from '../OCPPRequestService'; import { SendParams } from '../../../types/ocpp/Requests'; import Utils from '../../../utils/Utils'; -import logger from '../../../utils/Logger'; +import getLogger from '../../../utils/Logger'; export default class OCPP16RequestService extends OCPPRequestService { public async sendHeartbeat(params?: SendParams): Promise { @@ -139,7 +139,7 @@ export default class OCPP16RequestService extends OCPPRequestService { meterValue.sampledValue.push(OCPP16ServiceUtils.buildSampledValue(socSampledValueTemplate, socSampledValueTemplateValue)); const sampledValuesIndex = meterValue.sampledValue.length - 1; if (Utils.convertToInt(meterValue.sampledValue[sampledValuesIndex].value) > 100 || debug) { - logger.error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${meterValue.sampledValue[sampledValuesIndex].value}/100`); + getLogger().error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${meterValue.sampledValue[sampledValuesIndex].value}/100`); } } // Voltage measurand @@ -224,14 +224,14 @@ export default class OCPP16RequestService extends OCPPRequestService { : Utils.getRandomFloatRounded(maxPower / unitDivider); break; default: - logger.error(errMsg); + getLogger().error(errMsg); throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, OCPP16RequestCommand.METER_VALUES); } meterValue.sampledValue.push(OCPP16ServiceUtils.buildSampledValue(powerSampledValueTemplate, powerMeasurandValues.allPhases)); const sampledValuesIndex = meterValue.sampledValue.length - 1; const maxPowerRounded = Utils.roundTo(maxPower / unitDivider, 2); if (Utils.convertToFloat(meterValue.sampledValue[sampledValuesIndex].value) > maxPowerRounded || debug) { - logger.error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${meterValue.sampledValue[sampledValuesIndex].value}/${maxPowerRounded}`); + getLogger().error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${meterValue.sampledValue[sampledValuesIndex].value}/${maxPowerRounded}`); } for (let phase = 1; this.chargingStation.getNumberOfPhases() === 3 && phase <= this.chargingStation.getNumberOfPhases(); phase++) { const phaseValue = `L${phase}-N`; @@ -240,7 +240,7 @@ export default class OCPP16RequestService extends OCPPRequestService { const sampledValuesPerPhaseIndex = meterValue.sampledValue.length - 1; const maxPowerPerPhaseRounded = Utils.roundTo(maxPowerPerPhase / unitDivider, 2); if (Utils.convertToFloat(meterValue.sampledValue[sampledValuesPerPhaseIndex].value) > maxPowerPerPhaseRounded || debug) { - logger.error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesPerPhaseIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: phase ${meterValue.sampledValue[sampledValuesPerPhaseIndex].phase}, connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${meterValue.sampledValue[sampledValuesPerPhaseIndex].value}/${maxPowerPerPhaseRounded}`); + getLogger().error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesPerPhaseIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: phase ${meterValue.sampledValue[sampledValuesPerPhaseIndex].phase}, connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${meterValue.sampledValue[sampledValuesPerPhaseIndex].value}/${maxPowerPerPhaseRounded}`); } } } @@ -290,13 +290,13 @@ export default class OCPP16RequestService extends OCPPRequestService { : Utils.getRandomFloatRounded(maxAmperage); break; default: - logger.error(errMsg); + getLogger().error(errMsg); throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, OCPP16RequestCommand.METER_VALUES); } meterValue.sampledValue.push(OCPP16ServiceUtils.buildSampledValue(currentSampledValueTemplate, currentMeasurandValues.allPhases)); const sampledValuesIndex = meterValue.sampledValue.length - 1; if (Utils.convertToFloat(meterValue.sampledValue[sampledValuesIndex].value) > maxAmperage || debug) { - logger.error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${meterValue.sampledValue[sampledValuesIndex].value}/${maxAmperage}`); + getLogger().error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${meterValue.sampledValue[sampledValuesIndex].value}/${maxAmperage}`); } for (let phase = 1; this.chargingStation.getNumberOfPhases() === 3 && phase <= this.chargingStation.getNumberOfPhases(); phase++) { const phaseValue = `L${phase}`; @@ -304,7 +304,7 @@ export default class OCPP16RequestService extends OCPPRequestService { currentMeasurandValues[phaseValue], null, phaseValue as OCPP16MeterValuePhase)); const sampledValuesPerPhaseIndex = meterValue.sampledValue.length - 1; if (Utils.convertToFloat(meterValue.sampledValue[sampledValuesPerPhaseIndex].value) > maxAmperage || debug) { - logger.error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesPerPhaseIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: phase ${meterValue.sampledValue[sampledValuesPerPhaseIndex].phase}, connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${meterValue.sampledValue[sampledValuesPerPhaseIndex].value}/${maxAmperage}`); + getLogger().error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesPerPhaseIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: phase ${meterValue.sampledValue[sampledValuesPerPhaseIndex].phase}, connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${meterValue.sampledValue[sampledValuesPerPhaseIndex].value}/${maxAmperage}`); } } } @@ -331,7 +331,7 @@ export default class OCPP16RequestService extends OCPPRequestService { Utils.roundTo(this.chargingStation.getEnergyActiveImportRegisterByTransactionId(transactionId) / unitDivider, 2))); const sampledValuesIndex = meterValue.sampledValue.length - 1; if (energyValueRounded > maxEnergyRounded || debug) { - logger.error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${energyValueRounded}/${maxEnergyRounded}, duration: ${Utils.roundTo(interval / (3600 * 1000), 4)}h`); + getLogger().error(`${this.chargingStation.logPrefix()} MeterValues measurand ${meterValue.sampledValue[sampledValuesIndex].measurand ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: connectorId ${connectorId}, transaction ${connector.transactionId}, value: ${energyValueRounded}/${maxEnergyRounded}, duration: ${Utils.roundTo(interval / (3600 * 1000), 4)}h`); } } const payload: MeterValuesRequest = { diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index b7122726..3e6611f2 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -15,7 +15,7 @@ import OCPPError from '../../../exception/OCPPError'; import OCPPResponseService from '../OCPPResponseService'; import { ResponseHandler } from '../../../types/ocpp/Responses'; import Utils from '../../../utils/Utils'; -import logger from '../../../utils/Logger'; +import getLogger from '../../../utils/Logger'; export default class OCPP16ResponseService extends OCPPResponseService { private responseHandlers: Map; @@ -39,7 +39,7 @@ export default class OCPP16ResponseService extends OCPPResponseService { try { await this.responseHandlers.get(commandName)(payload, requestPayload); } catch (error) { - logger.error(this.chargingStation.logPrefix() + ' Handle request response error: %j', error); + getLogger().error(this.chargingStation.logPrefix() + ' Handle request response error: %j', error); throw error; } } else { @@ -59,14 +59,14 @@ export default class OCPP16ResponseService extends OCPPResponseService { } if (Object.values(OCPP16RegistrationStatus).includes(payload.status)) { const logMsg = `${this.chargingStation.logPrefix()} Charging station in '${payload.status}' state on the central server`; - payload.status === OCPP16RegistrationStatus.REJECTED ? logger.warn(logMsg) : logger.info(logMsg); + payload.status === OCPP16RegistrationStatus.REJECTED ? getLogger().warn(logMsg) : getLogger().info(logMsg); } else { - logger.error(this.chargingStation.logPrefix() + ' Charging station boot notification response received: %j with undefined registration status', payload); + getLogger().error(this.chargingStation.logPrefix() + ' Charging station boot notification response received: %j with undefined registration status', payload); } } private handleResponseHeartbeat(payload: HeartbeatResponse, requestPayload: HeartbeatRequest): void { - logger.debug(this.chargingStation.logPrefix() + ' Heartbeat response received: %j to Heartbeat request: %j', payload, requestPayload); + getLogger().debug(this.chargingStation.logPrefix() + ' Heartbeat response received: %j to Heartbeat request: %j', payload, requestPayload); } private handleResponseAuthorize(payload: OCPP16AuthorizeResponse, requestPayload: AuthorizeRequest): void { @@ -79,11 +79,11 @@ export default class OCPP16ResponseService extends OCPPResponseService { } if (payload.idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED) { this.chargingStation.getConnectorStatus(authorizeConnectorId).idTagAuthorized = true; - logger.debug(`${this.chargingStation.logPrefix()} IdTag ${requestPayload.idTag} authorized on connector ${authorizeConnectorId}`); + getLogger().debug(`${this.chargingStation.logPrefix()} IdTag ${requestPayload.idTag} authorized on connector ${authorizeConnectorId}`); } else { this.chargingStation.getConnectorStatus(authorizeConnectorId).idTagAuthorized = false; delete this.chargingStation.getConnectorStatus(authorizeConnectorId).authorizeIdTag; - logger.debug(`${this.chargingStation.logPrefix()} IdTag ${requestPayload.idTag} refused with status ${payload.idTagInfo.status} on connector ${authorizeConnectorId}`); + getLogger().debug(`${this.chargingStation.logPrefix()} IdTag ${requestPayload.idTag} refused with status ${payload.idTagInfo.status} on connector ${authorizeConnectorId}`); } } @@ -98,44 +98,44 @@ export default class OCPP16ResponseService extends OCPPResponseService { } } if (!transactionConnectorId) { - logger.error(this.chargingStation.logPrefix() + ' Trying to start a transaction on a non existing connector Id ' + connectorId.toString()); + getLogger().error(this.chargingStation.logPrefix() + ' Trying to start a transaction on a non existing connector Id ' + connectorId.toString()); return; } if (this.chargingStation.getConnectorStatus(connectorId).transactionRemoteStarted && this.chargingStation.getAuthorizeRemoteTxRequests() && this.chargingStation.getLocalAuthListEnabled() && this.chargingStation.hasAuthorizedTags() && !this.chargingStation.getConnectorStatus(connectorId).idTagLocalAuthorized) { - logger.error(this.chargingStation.logPrefix() + ' Trying to start a transaction with a not local authorized idTag ' + this.chargingStation.getConnectorStatus(connectorId).localAuthorizeIdTag + ' on connector Id ' + connectorId.toString()); + getLogger().error(this.chargingStation.logPrefix() + ' Trying to start a transaction with a not local authorized idTag ' + this.chargingStation.getConnectorStatus(connectorId).localAuthorizeIdTag + ' on connector Id ' + connectorId.toString()); await this.resetConnectorOnStartTransactionError(connectorId); return; } if (this.chargingStation.getConnectorStatus(connectorId).transactionRemoteStarted && this.chargingStation.getAuthorizeRemoteTxRequests() && this.chargingStation.getMayAuthorizeAtRemoteStart() && !this.chargingStation.getConnectorStatus(connectorId).idTagLocalAuthorized && !this.chargingStation.getConnectorStatus(connectorId).idTagAuthorized) { - logger.error(this.chargingStation.logPrefix() + ' Trying to start a transaction with a not authorized idTag ' + this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag + ' on connector Id ' + connectorId.toString()); + getLogger().error(this.chargingStation.logPrefix() + ' Trying to start a transaction with a not authorized idTag ' + this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag + ' on connector Id ' + connectorId.toString()); await this.resetConnectorOnStartTransactionError(connectorId); return; } if (this.chargingStation.getConnectorStatus(connectorId).idTagAuthorized && this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag !== requestPayload.idTag) { - logger.error(this.chargingStation.logPrefix() + ' Trying to start a transaction with an idTag ' + requestPayload.idTag + ' different from the authorize request one ' + this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag + ' on connector Id ' + connectorId.toString()); + getLogger().error(this.chargingStation.logPrefix() + ' Trying to start a transaction with an idTag ' + requestPayload.idTag + ' different from the authorize request one ' + this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag + ' on connector Id ' + connectorId.toString()); await this.resetConnectorOnStartTransactionError(connectorId); return; } if (this.chargingStation.getConnectorStatus(connectorId).idTagLocalAuthorized && this.chargingStation.getConnectorStatus(connectorId).localAuthorizeIdTag !== requestPayload.idTag) { - logger.error(this.chargingStation.logPrefix() + ' Trying to start a transaction with an idTag ' + requestPayload.idTag + ' different from the local authorized one ' + this.chargingStation.getConnectorStatus(connectorId).localAuthorizeIdTag + ' on connector Id ' + connectorId.toString()); + getLogger().error(this.chargingStation.logPrefix() + ' Trying to start a transaction with an idTag ' + requestPayload.idTag + ' different from the local authorized one ' + this.chargingStation.getConnectorStatus(connectorId).localAuthorizeIdTag + ' on connector Id ' + connectorId.toString()); await this.resetConnectorOnStartTransactionError(connectorId); return; } if (this.chargingStation.getConnectorStatus(connectorId)?.transactionStarted) { - logger.debug(this.chargingStation.logPrefix() + ' Trying to start a transaction on an already used connector ' + connectorId.toString() + ': %j', this.chargingStation.getConnectorStatus(connectorId)); + getLogger().debug(this.chargingStation.logPrefix() + ' Trying to start a transaction on an already used connector ' + connectorId.toString() + ': %j', this.chargingStation.getConnectorStatus(connectorId)); return; } if (this.chargingStation.getConnectorStatus(connectorId)?.status !== OCPP16ChargePointStatus.AVAILABLE && this.chargingStation.getConnectorStatus(connectorId)?.status !== OCPP16ChargePointStatus.PREPARING) { - logger.error(`${this.chargingStation.logPrefix()} Trying to start a transaction on connector ${connectorId.toString()} with status ${this.chargingStation.getConnectorStatus(connectorId)?.status}`); + getLogger().error(`${this.chargingStation.logPrefix()} Trying to start a transaction on connector ${connectorId.toString()} with status ${this.chargingStation.getConnectorStatus(connectorId)?.status}`); return; } if (!Number.isInteger(payload.transactionId)) { - logger.warn(`${this.chargingStation.logPrefix()} Trying to start a transaction on connector ${connectorId.toString()} with a non integer transaction Id ${payload.transactionId}, converting to integer`); + getLogger().warn(`${this.chargingStation.logPrefix()} Trying to start a transaction on connector ${connectorId.toString()} with a non integer transaction Id ${payload.transactionId}, converting to integer`); payload.transactionId = Utils.convertToInt(payload.transactionId); } @@ -150,14 +150,14 @@ export default class OCPP16ResponseService extends OCPPResponseService { this.chargingStation.getConnectorStatus(connectorId).transactionBeginMeterValue); await this.chargingStation.ocppRequestService.sendStatusNotification(connectorId, OCPP16ChargePointStatus.CHARGING); this.chargingStation.getConnectorStatus(connectorId).status = OCPP16ChargePointStatus.CHARGING; - logger.info(this.chargingStation.logPrefix() + ' Transaction ' + payload.transactionId.toString() + ' STARTED on ' + this.chargingStation.stationInfo.chargingStationId + '#' + connectorId.toString() + ' for idTag ' + requestPayload.idTag); + getLogger().info(this.chargingStation.logPrefix() + ' Transaction ' + payload.transactionId.toString() + ' STARTED on ' + this.chargingStation.stationInfo.chargingStationId + '#' + connectorId.toString() + ' for idTag ' + requestPayload.idTag); if (this.chargingStation.stationInfo.powerSharedByConnectors) { this.chargingStation.stationInfo.powerDivider++; } const configuredMeterValueSampleInterval = this.chargingStation.getConfigurationKey(OCPP16StandardParametersKey.MeterValueSampleInterval); this.chargingStation.startMeterValues(connectorId, configuredMeterValueSampleInterval ? Utils.convertToInt(configuredMeterValueSampleInterval.value) * 1000 : 60000); } else { - logger.warn(this.chargingStation.logPrefix() + ' Starting transaction id ' + payload.transactionId.toString() + ' REJECTED with status ' + payload?.idTagInfo?.status + ', idTag ' + requestPayload.idTag); + getLogger().warn(this.chargingStation.logPrefix() + ' Starting transaction id ' + payload.transactionId.toString() + ' REJECTED with status ' + payload?.idTagInfo?.status + ', idTag ' + requestPayload.idTag); await this.resetConnectorOnStartTransactionError(connectorId); } } @@ -179,7 +179,7 @@ export default class OCPP16ResponseService extends OCPPResponseService { } } if (!transactionConnectorId) { - logger.error(this.chargingStation.logPrefix() + ' Trying to stop a non existing transaction ' + requestPayload.transactionId.toString()); + getLogger().error(this.chargingStation.logPrefix() + ' Trying to stop a non existing transaction ' + requestPayload.transactionId.toString()); return; } if (payload.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) { @@ -196,18 +196,18 @@ export default class OCPP16ResponseService extends OCPPResponseService { if (this.chargingStation.stationInfo.powerSharedByConnectors) { this.chargingStation.stationInfo.powerDivider--; } - logger.info(this.chargingStation.logPrefix() + ' Transaction ' + requestPayload.transactionId.toString() + ' STOPPED on ' + this.chargingStation.stationInfo.chargingStationId + '#' + transactionConnectorId.toString()); + getLogger().info(this.chargingStation.logPrefix() + ' Transaction ' + requestPayload.transactionId.toString() + ' STOPPED on ' + this.chargingStation.stationInfo.chargingStationId + '#' + transactionConnectorId.toString()); this.chargingStation.resetConnectorStatus(transactionConnectorId); } else { - logger.warn(this.chargingStation.logPrefix() + ' Stopping transaction id ' + requestPayload.transactionId.toString() + ' REJECTED with status ' + payload.idTagInfo?.status); + getLogger().warn(this.chargingStation.logPrefix() + ' Stopping transaction id ' + requestPayload.transactionId.toString() + ' REJECTED with status ' + payload.idTagInfo?.status); } } private handleResponseStatusNotification(payload: StatusNotificationRequest, requestPayload: StatusNotificationResponse): void { - logger.debug(this.chargingStation.logPrefix() + ' Status notification response received: %j to StatusNotification request: %j', payload, requestPayload); + getLogger().debug(this.chargingStation.logPrefix() + ' Status notification response received: %j to StatusNotification request: %j', payload, requestPayload); } private handleResponseMeterValues(payload: MeterValuesRequest, requestPayload: MeterValuesResponse): void { - logger.debug(this.chargingStation.logPrefix() + ' MeterValues response received: %j to MeterValues request: %j', payload, requestPayload); + getLogger().debug(this.chargingStation.logPrefix() + ' MeterValues response received: %j to MeterValues request: %j', payload, requestPayload); } } diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index f55c7429..276d2016 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -8,17 +8,17 @@ import OCPPError from '../../../exception/OCPPError'; import { RequestCommand } from '../../../types/ocpp/Requests'; import { SampledValueTemplate } from '../../../types/MeasurandPerPhaseSampledValueTemplates'; import Utils from '../../../utils/Utils'; -import logger from '../../../utils/Logger'; +import getLogger from '../../../utils/Logger'; export class OCPP16ServiceUtils { public static checkMeasurandPowerDivider(chargingStation: ChargingStation, measurandType: OCPP16MeterValueMeasurand): void { if (Utils.isUndefined(chargingStation.stationInfo.powerDivider)) { const errMsg = `${chargingStation.logPrefix()} MeterValues measurand ${measurandType ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: powerDivider is undefined`; - logger.error(errMsg); + getLogger().error(errMsg); throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, RequestCommand.METER_VALUES); } else if (chargingStation.stationInfo?.powerDivider <= 0) { const errMsg = `${chargingStation.logPrefix()} MeterValues measurand ${measurandType ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: powerDivider have zero or below value ${chargingStation.stationInfo.powerDivider}`; - logger.error(errMsg); + getLogger().error(errMsg); throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, RequestCommand.METER_VALUES); } } diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index e1651539..3f8dda43 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -1,7 +1,7 @@ import ChargingStation from '../ChargingStation'; import { IncomingRequestCommand } from '../../types/ocpp/Requests'; import { JsonType } from '../../types/JsonType'; -import logger from '../../utils/Logger'; +import getLogger from '../../utils/Logger'; export default abstract class OCPPIncomingRequestService { protected chargingStation: ChargingStation; @@ -11,7 +11,7 @@ export default abstract class OCPPIncomingRequestService { } protected handleIncomingRequestError(commandName: IncomingRequestCommand, error: Error, errorOcppResponse?: T): T { - logger.error(this.chargingStation.logPrefix() + ' Incoming request command %s error: %j', commandName, error); + getLogger().error(this.chargingStation.logPrefix() + ' Incoming request command %s error: %j', commandName, error); if (errorOcppResponse) { return errorOcppResponse; } diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index da887029..9f7fcfb8 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -14,7 +14,7 @@ import OCPPError from '../../exception/OCPPError'; import OCPPResponseService from './OCPPResponseService'; import PerformanceStatistics from '../../performance/PerformanceStatistics'; import Utils from '../../utils/Utils'; -import logger from '../../utils/Logger'; +import getLogger from '../../utils/Logger'; export default abstract class OCPPRequestService { public chargingStation: ChargingStation; @@ -99,7 +99,7 @@ export default abstract class OCPPRequestService { if (requestStatistic && self.chargingStation.getEnableStatistics()) { self.chargingStation.performanceStatistics.addRequestStatistic(commandName, MessageType.CALL_ERROR_MESSAGE); } - logger.error(`${self.chargingStation.logPrefix()} Error %j occurred when calling command %s with message data %j`, error, commandName, messageData); + getLogger().error(`${self.chargingStation.logPrefix()} Error %j occurred when calling command %s with message data %j`, error, commandName, messageData); self.chargingStation.requests.delete(messageId); reject(error); } @@ -111,7 +111,7 @@ export default abstract class OCPPRequestService { } protected handleRequestError(commandName: RequestCommand, error: Error): void { - logger.error(this.chargingStation.logPrefix() + ' Request command %s error: %j', commandName, error); + getLogger().error(this.chargingStation.logPrefix() + ' Request command %s error: %j', commandName, error); throw error; } diff --git a/src/charging-station/ui-websocket-services/AbstractUIService.ts b/src/charging-station/ui-websocket-services/AbstractUIService.ts index 2dd6a200..b4905da4 100644 --- a/src/charging-station/ui-websocket-services/AbstractUIService.ts +++ b/src/charging-station/ui-websocket-services/AbstractUIService.ts @@ -3,7 +3,7 @@ import { ProtocolCommand, ProtocolRequestHandler } from '../../types/UIProtocol' import BaseError from '../../exception/BaseError'; import { JsonType } from '../../types/JsonType'; import UIWebSocketServer from '../UIWebSocketServer'; -import logger from '../../utils/Logger'; +import getLogger from '../../utils/Logger'; export default abstract class AbstractUIService { protected readonly uiWebSocketServer: UIWebSocketServer; @@ -24,7 +24,7 @@ export default abstract class AbstractUIService { messageResponse = await this.messageHandlers.get(command)(payload) as JsonType; } catch (error) { // Log - logger.error(this.uiWebSocketServer.logPrefix() + ' Handle message error: %j', error); + getLogger().error(this.uiWebSocketServer.logPrefix() + ' Handle message error: %j', error); throw error; } } else { diff --git a/src/charging-station/ui-websocket-services/UIServiceUtils.ts b/src/charging-station/ui-websocket-services/UIServiceUtils.ts index 2c37e80a..e71b5f33 100644 --- a/src/charging-station/ui-websocket-services/UIServiceUtils.ts +++ b/src/charging-station/ui-websocket-services/UIServiceUtils.ts @@ -2,7 +2,7 @@ import { Protocol, ProtocolVersion } from '../../types/UIProtocol'; import { IncomingMessage } from 'http'; import Utils from '../../utils/Utils'; -import logger from '../../utils/Logger'; +import getLogger from '../../utils/Logger'; export class UIServiceUtils { public static handleProtocols = (protocols: Set, request: IncomingMessage): string | false => { @@ -17,7 +17,7 @@ export class UIServiceUtils { return fullProtocol; } } - logger.error(`${Utils.logPrefix(' UI WebSocket Server:')} Unsupported protocol: ${protocol} or protocol version: ${version}`); + getLogger().error(`${Utils.logPrefix(' UI WebSocket Server:')} Unsupported protocol: ${protocol} or protocol version: ${version}`); return false; }; } diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index 483a3d6c..96006346 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -10,7 +10,7 @@ import Configuration from '../utils/Configuration'; import { MessageType } from '../types/ocpp/MessageType'; import { URL } from 'url'; import Utils from '../utils/Utils'; -import logger from '../utils/Logger'; +import getLogger from '../utils/Logger'; import { parentPort } from 'worker_threads'; export default class PerformanceStatistics { @@ -60,7 +60,7 @@ export default class PerformanceStatistics { } break; default: - logger.error(`${this.logPrefix()} wrong message type ${messageType}`); + getLogger().error(`${this.logPrefix()} wrong message type ${messageType}`); break; } } @@ -68,7 +68,7 @@ export default class PerformanceStatistics { public start(): void { this.startLogStatisticsInterval(); if (Configuration.getPerformanceStorage().enabled) { - logger.info(`${this.logPrefix()} storage enabled: type ${Configuration.getPerformanceStorage().type}, uri: ${Configuration.getPerformanceStorage().uri}`); + getLogger().info(`${this.logPrefix()} storage enabled: type ${Configuration.getPerformanceStorage().type}, uri: ${Configuration.getPerformanceStorage().uri}`); } } @@ -89,13 +89,13 @@ export default class PerformanceStatistics { this.performanceObserver = new PerformanceObserver((list) => { const lastPerformanceEntry = list.getEntries()[0]; this.addPerformanceEntryToStatistics(lastPerformanceEntry); - logger.debug(`${this.logPrefix()} '${lastPerformanceEntry.name}' performance entry: %j`, lastPerformanceEntry); + getLogger().debug(`${this.logPrefix()} '${lastPerformanceEntry.name}' performance entry: %j`, lastPerformanceEntry); }); this.performanceObserver.observe({ entryTypes: ['measure'] }); } private logStatistics(): void { - logger.info(this.logPrefix() + ' %j', this.statistics); + getLogger().info(this.logPrefix() + ' %j', this.statistics); } private startLogStatisticsInterval(): void { @@ -103,9 +103,9 @@ export default class PerformanceStatistics { this.displayInterval = setInterval(() => { this.logStatistics(); }, Configuration.getLogStatisticsInterval() * 1000); - logger.info(this.logPrefix() + ' logged every ' + Utils.formatDurationSeconds(Configuration.getLogStatisticsInterval())); + getLogger().info(this.logPrefix() + ' logged every ' + Utils.formatDurationSeconds(Configuration.getLogStatisticsInterval())); } else { - logger.info(this.logPrefix() + ' log interval is set to ' + Configuration.getLogStatisticsInterval().toString() + '. Not logging statistics'); + getLogger().info(this.logPrefix() + ' log interval is set to ' + Configuration.getLogStatisticsInterval().toString() + '. Not logging statistics'); } } diff --git a/src/performance/storage/Storage.ts b/src/performance/storage/Storage.ts index db33a694..80906699 100644 --- a/src/performance/storage/Storage.ts +++ b/src/performance/storage/Storage.ts @@ -5,7 +5,7 @@ import { DBName, StorageType } from '../../types/Storage'; import Statistics from '../../types/Statistics'; import { URL } from 'url'; import Utils from '../../utils/Utils'; -import logger from '../../utils/Logger'; +import getLogger from '../../utils/Logger'; export abstract class Storage { protected readonly storageUri: URL; @@ -18,7 +18,7 @@ export abstract class Storage { } protected handleDBError(type: StorageType, error: Error, table?: string): void { - logger.error(`${this.logPrefix} ${this.getDBNameFromStorageType(type)} error '${error.message}'${(!Utils.isNullOrUndefined(table) || !table) && ` in table or collection '${table}'`}: %j`, error); + getLogger().error(`${this.logPrefix} ${this.getDBNameFromStorageType(type)} error '${error.message}'${(!Utils.isNullOrUndefined(table) || !table) && ` in table or collection '${table}'`}: %j`, error); } protected getDBNameFromStorageType(type: StorageType): DBName { diff --git a/src/utils/FileUtils.ts b/src/utils/FileUtils.ts index e68500e3..c6850c71 100644 --- a/src/utils/FileUtils.ts +++ b/src/utils/FileUtils.ts @@ -1,5 +1,5 @@ import chalk from 'chalk'; -import logger from './Logger'; +import getLogger from './Logger'; export default class FileUtils { static handleFileException(logPrefix: string, fileType: string, filePath: string, error: NodeJS.ErrnoException, consoleOut = false): void { @@ -8,25 +8,25 @@ export default class FileUtils { if (consoleOut) { console.warn(chalk.green(prefix) + chalk.yellow(fileType + ' file ' + filePath + ' not found: '), error); } else { - logger.warn(prefix + fileType + ' file ' + filePath + ' not found: %j', error); + getLogger().warn(prefix + fileType + ' file ' + filePath + ' not found: %j', error); } } else if (error.code === 'EEXIST') { if (consoleOut) { console.warn(chalk.green(prefix) + chalk.yellow(fileType + ' file ' + filePath + ' already exists: '), error); } else { - logger.warn(prefix + fileType + ' file ' + filePath + ' already exists: %j', error); + getLogger().warn(prefix + fileType + ' file ' + filePath + ' already exists: %j', error); } } else if (error.code === 'EACCES') { if (consoleOut) { console.warn(chalk.green(prefix) + chalk.yellow(fileType + ' file ' + filePath + ' access denied: '), error); } else { - logger.warn(prefix + fileType + ' file ' + filePath + ' access denied: %j', error); + getLogger().warn(prefix + fileType + ' file ' + filePath + ' access denied: %j', error); } } else { if (consoleOut) { console.warn(chalk.green(prefix) + chalk.yellow(fileType + ' file ' + filePath + ' error: '), error); } else { - logger.warn(prefix + fileType + ' file ' + filePath + ' error: %j', error); + getLogger().warn(prefix + fileType + ' file ' + filePath + ' error: %j', error); } throw error; } diff --git a/src/utils/Logger.ts b/src/utils/Logger.ts index ccbc63ca..a558adad 100644 --- a/src/utils/Logger.ts +++ b/src/utils/Logger.ts @@ -19,20 +19,26 @@ if (Configuration.getLogRotate()) { ]; } -const logger: Logger = createLogger({ - level: Configuration.getLogLevel(), - format: format.combine(format.splat(), format[Configuration.getLogFormat()]()), - transports: transports, -}); +let loggerInstance: Logger | null = null; +const getLogger = () => { + if (!loggerInstance) { + loggerInstance = createLogger({ + level: Configuration.getLogLevel(), + format: format.combine(format.splat(), format[Configuration.getLogFormat()]()), + transports: transports, + }); + return loggerInstance; + } +}; // // If enabled, log to the `console` with the format: // `${info.level}: ${info.message} JSON.stringify({ ...rest }) ` // if (Configuration.getLogConsole()) { - logger.add(new Console({ + getLogger().add(new Console({ format: format.combine(format.splat(), format[Configuration.getLogFormat()]()), })); } -export default logger; +export default getLogger; -- 2.34.1