diff --git a/packages/api/src/index.js b/packages/api/src/index.js index 78db2cf4..8910b7e1 100644 --- a/packages/api/src/index.js +++ b/packages/api/src/index.js @@ -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({