diff --git a/electron/renderer/static/webview-preload.js b/electron/renderer/static/webview-preload.js index 7f804a9d43a..f098deb6dd1 100644 --- a/electron/renderer/static/webview-preload.js +++ b/electron/renderer/static/webview-preload.js @@ -120,20 +120,23 @@ function replaceGoogleAuth() { function enableFileLogging() { const id = new URL(window.location).searchParams.get('id'); - const logName = require('../../js/config').CONSOLE_LOG; - const logFilePath = path.join(app.getPath('userData'), 'logs', id, logName); - fs.createFileSync(logFilePath); - - const logger = new winston.Logger(); - logger.add(winston.transports.File, { - filename: logFilePath, - handleExceptions: true, - }); - logger.info(pkg.productName, 'Version', pkg.version); + if (id) { + const logName = require('../../js/config').CONSOLE_LOG; + const logFilePath = path.join(app.getPath('userData'), 'logs', id, logName); + fs.createFileSync(logFilePath); + + const logger = new winston.Logger(); + logger.add(winston.transports.File, { + filename: logFilePath, + handleExceptions: true, + }); - // webapp uses global winston reference to define log level - global.winston = logger; + logger.info(pkg.productName, 'Version', pkg.version); + + // webapp uses global winston reference to define log level + global.winston = logger; + } } function reportWebappVersion() {