X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FFileUtils.ts;h=e68500e33b5821a2dc5d9f5876949b7d3ac28d9f;hb=9f2e313013116428f5bce2be59e2f5c07502c026;hp=c6850c7103d47e9f05053fc8afaaefde961a9fcd;hpb=28e6dd3a9fd0db84953aa8d149d0a19fadc63554;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/FileUtils.ts b/src/utils/FileUtils.ts index c6850c71..e68500e3 100644 --- a/src/utils/FileUtils.ts +++ b/src/utils/FileUtils.ts @@ -1,5 +1,5 @@ import chalk from 'chalk'; -import getLogger from './Logger'; +import logger 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 { - getLogger().warn(prefix + fileType + ' file ' + filePath + ' not found: %j', error); + logger.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 { - getLogger().warn(prefix + fileType + ' file ' + filePath + ' already exists: %j', error); + logger.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 { - getLogger().warn(prefix + fileType + ' file ' + filePath + ' access denied: %j', error); + logger.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 { - getLogger().warn(prefix + fileType + ' file ' + filePath + ' error: %j', error); + logger.warn(prefix + fileType + ' file ' + filePath + ' error: %j', error); } throw error; }