X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FFileUtils.ts;h=10317c7353f4855a4a0f24ecb42d809b5f0b1f03;hb=5612b691da864fc2822629bbee32ed8008ee6472;hp=f38bde6c8ea66218887438eefa23832c7e6aa0e9;hpb=9d7484a4667898757b7c23be3dec7458c337cb84;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/FileUtils.ts b/src/utils/FileUtils.ts index f38bde6c..10317c73 100644 --- a/src/utils/FileUtils.ts +++ b/src/utils/FileUtils.ts @@ -1,13 +1,19 @@ +import fs from 'fs'; + +import chalk from 'chalk'; + import { EmptyObject } from '../types/EmptyObject'; -import { FileType } from '../types/FileType'; import { HandleErrorParams } from '../types/Error'; +import { FileType } from '../types/FileType'; import { JsonType } from '../types/JsonType'; -import Utils from './Utils'; -import chalk from 'chalk'; -import fs from 'fs'; import logger from './Logger'; +import Utils from './Utils'; export default class FileUtils { + private constructor() { + // This is intentional + } + public static watchJsonFile( 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;