Why my console.log doesn't display into devTools in my very simple electron app ?
I console.log into js file loaded by renderer process electron.
If I console.log into main process electron I can view the result into command line with no problem
I can see that the js file is loaded by the renderer process into devTools > network part. But nothing console.log wrote into devTools > Console part.
index.js :
const {app, BrowserWindow} = require('electron')
let win
function createWindow () {
win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
webSecurity: false
}
})
win.loadFile('index.html')
win.webContents.openDevTools()
console.log('main test')
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
index.html file :
<h1>MAIN PAGE</h1>
<script type="javascript" src="midi-test.js"></script>
<button type="button">TEST</button>
midi-test.js file :
var navigator = require('jzz')
console.log('test')
if (navigator.requestMIDIAccess){
console.log('OK')
}
else{
console.log('KO')
}
I don't want to use electron-log npm package for writing console.log into OS file.
I don't want to redirect console.log renderer process to main process command-line.
Lot of questions about this issue but nothing simple response find.