mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
using winston logger
This commit is contained in:
@@ -4,6 +4,7 @@ import { readFile } from 'fs/promises';
|
||||
import { createHash } from 'crypto';
|
||||
import { DEFAULT_CONFIG } from './defaultConfig.js';
|
||||
import fs from 'fs';
|
||||
import logger from './services/logger.js';
|
||||
|
||||
const RE_GT = />/g;
|
||||
const RE_WEBP = /\/format\/webp/gi;
|
||||
@@ -74,8 +75,7 @@ export async function refreshConfig() {
|
||||
config.demoMode ??= false;
|
||||
} catch (error) {
|
||||
config = { ...DEFAULT_CONFIG };
|
||||
/* eslint-disable no-console */
|
||||
console.info('Error reading config file.', error);
|
||||
logger.info('Error reading config file.', error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export async function refreshConfig() {
|
||||
*/
|
||||
const checkIfConfigExistsAndWriteIfNot = () => {
|
||||
if (!fs.existsSync(`${getDirName()}/../conf/config.json`)) {
|
||||
console.info('Could not find config file. Will create one with default values now');
|
||||
logger.info('Could not find config file. Will create one with default values now');
|
||||
fs.writeFileSync(`${getDirName()}/../conf/config.json`, JSON.stringify({ ...DEFAULT_CONFIG }));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user