Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
contents.on('console-message', async (event, level, message) => {
const webViewId = getWebViewId(contents);
if (webViewId) {
const logFilePath = path.join(LOG_DIR, webViewId, config.logFileName);
try {
await LogFactory.writeMessage(message, logFilePath);
} catch (error) {
logger.log(`Cannot write to log file "${logFilePath}": ${error.message}`, error);
}
}
});
}