using winston logger

This commit is contained in:
orangecoding
2025-09-13 18:57:56 +02:00
parent e868cdce86
commit 21415dcff3
19 changed files with 230 additions and 49 deletions

View File

@@ -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 }));
}
};