This commit is contained in:
Jan Prochazka 2024-05-27 14:05:44 +02:00
parent 22bed04d13
commit 4f5db15c20

View File

@ -30,23 +30,28 @@ function configureLogger() {
setLogsFilePath(logsFilePath);
setLoggerName('main');
const consoleLogLevel = process.env.CONSOLE_LOG_LEVEL || process.env.LOG_LEVEL || 'info';
const fileLogLevel = process.env.FILE_LOG_LEVEL || process.env.LOG_LEVEL || 'debug';
const logger = createLogger({
base: { pid: process.pid },
targets: [
{
type: 'console',
// @ts-ignore
level: process.env.CONSOLE_LOG_LEVEL || process.env.LOG_LEVEL || 'info',
level: consoleLogLevel,
},
{
type: 'stream',
// @ts-ignore
level: process.env.FILE_LOG_LEVEL || process.env.LOG_LEVEL || 'debug',
level: fileLogLevel,
stream: fs.createWriteStream(logsFilePath, { flags: 'a' }),
},
],
});
logger.info(`Initialized logging, console log level: ${consoleLogLevel}, file log level: ${fileLogLevel}`);
// const streams = [];
// if (!platformInfo.isElectron) {
// streams.push({