Rename a method to avoid confusion
[e-mobility-charging-stations-simulator.git] / src / charging-station / ui-websocket-services / UIServiceUtils.ts
index e71b5f339e2349d245530a5f21754279389a6ed8..9427c08e5aa61b466a77e6caa5f111e3af8147ed 100644 (file)
@@ -2,22 +2,35 @@ import { Protocol, ProtocolVersion } from '../../types/UIProtocol';
 
 import { IncomingMessage } from 'http';
 import Utils from '../../utils/Utils';
-import getLogger from '../../utils/Logger';
+import logger from '../../utils/Logger';
 
 export class UIServiceUtils {
-  public static handleProtocols = (protocols: Set<string>, request: IncomingMessage): string | false => {
+  public static handleProtocols = (
+    protocols: Set<string>,
+    request: IncomingMessage
+  ): string | false => {
     let protocolIndex: number;
     let protocol: Protocol;
     let version: ProtocolVersion;
     for (const fullProtocol of protocols) {
       protocolIndex = fullProtocol.indexOf(Protocol.UI);
-      protocol = fullProtocol.substring(protocolIndex, protocolIndex + Protocol.UI.length) as Protocol;
+      protocol = fullProtocol.substring(
+        protocolIndex,
+        protocolIndex + Protocol.UI.length
+      ) as Protocol;
       version = fullProtocol.substring(protocolIndex + Protocol.UI.length) as ProtocolVersion;
-      if (Object.values(Protocol).includes(protocol) && Object.values(ProtocolVersion).includes(version)) {
+      if (
+        Object.values(Protocol).includes(protocol) &&
+        Object.values(ProtocolVersion).includes(version)
+      ) {
         return fullProtocol;
       }
     }
-    getLogger().error(`${Utils.logPrefix(' UI WebSocket Server:')} Unsupported protocol: ${protocol} or protocol version: ${version}`);
+    logger.error(
+      `${Utils.logPrefix(
+        ' UI WebSocket Server:'
+      )} Unsupported protocol: ${protocol} or protocol version: ${version}`
+    );
     return false;
   };
 }