Broadcast Channel: optimize requests handling implementation
[e-mobility-charging-stations-simulator.git] / src / utils / FileUtils.ts
index f38bde6c8ea66218887438eefa23832c7e6aa0e9..8de719a152d35e9da5c16b434a3989ad3e95f782 100644 (file)
@@ -1,13 +1,19 @@
-import { EmptyObject } from '../types/EmptyObject';
-import { FileType } from '../types/FileType';
-import { HandleErrorParams } from '../types/Error';
-import { JsonType } from '../types/JsonType';
-import Utils from './Utils';
-import chalk from 'chalk';
 import fs from 'fs';
+
+import chalk from 'chalk';
+
+import type { EmptyObject } from '../types/EmptyObject';
+import type { HandleErrorParams } from '../types/Error';
+import type { FileType } from '../types/FileType';
+import type { JsonType } from '../types/JsonType';
 import logger from './Logger';
+import Utils from './Utils';
 
 export default class FileUtils {
+  private constructor() {
+    // This is intentional
+  }
+
   public static watchJsonFile<T extends JsonType>(
     logPrefix: string,
     fileType: FileType,
@@ -54,7 +60,7 @@ export default class FileUtils {
           error
         );
       } else {
-        logger.warn(prefix + fileType + ' file ' + file + ' not found: %j', error);
+        logger.warn(prefix + fileType + ' file ' + file + ' not found:', error);
       }
     } else if (error.code === 'EEXIST') {
       if (params?.consoleOut) {
@@ -63,7 +69,7 @@ export default class FileUtils {
           error
         );
       } else {
-        logger.warn(prefix + fileType + ' file ' + file + ' already exists: %j', error);
+        logger.warn(prefix + fileType + ' file ' + file + ' already exists:', error);
       }
     } else if (error.code === 'EACCES') {
       if (params?.consoleOut) {
@@ -72,7 +78,7 @@ export default class FileUtils {
           error
         );
       } else {
-        logger.warn(prefix + fileType + ' file ' + file + ' access denied: %j', error);
+        logger.warn(prefix + fileType + ' file ' + file + ' access denied:', error);
       }
     } else {
       if (params?.consoleOut) {
@@ -81,7 +87,7 @@ export default class FileUtils {
           error
         );
       } else {
-        logger.warn(prefix + fileType + ' file ' + file + ' error: %j', error);
+        logger.warn(prefix + fileType + ' file ' + file + ' error:', error);
       }
       if (params?.throwError) {
         throw error;