listener: fs.WatchListener<string> = (event, filename) => {
if (filename && event === 'change') {
try {
- logger.debug(`${logPrefix} ${fileType} file ${file} + ' have changed, reload'`);
+ logger.debug(`${logPrefix} ${fileType} file ${file} have changed, reload`);
refreshedVariable && (refreshedVariable = JSON.parse(fs.readFileSync(file, 'utf8')) as T);
} catch (error) {
FileUtils.handleFileException(logPrefix, fileType, file, error as NodeJS.ErrnoException, {
}
}
}
- ): fs.FSWatcher {
+ ): fs.FSWatcher | undefined {
if (file) {
try {
return fs.watch(file, listener);
error: NodeJS.ErrnoException,
params: HandleErrorParams<EmptyObject> = { throwError: true, consoleOut: false }
): void {
- const prefix = !Utils.isEmptyString(logPrefix) ? logPrefix + ' ' : '';
+ const prefix = !Utils.isEmptyString(logPrefix) ? `${logPrefix} ` : '';
let logMsg: string;
switch (error.code) {
case 'ENOENT':