'electron app is getting 34352:0406/075851.692:ERROR:CONSOLE(6)] "console.assert"

In my electron app I'd like to use console.trace() but want it to be collapsed by default. For that I use this in renderer process:

{
  const {groupCollapsed, groupEnd, trace} = console;

  console.trace = ((...args:any[]) =>
  {
    groupCollapsed(...args);
    trace("");
    groupEnd();
  }).bind(console);
}

It works ok (time to time few messages from async functions getting grouped together), however in main process I'm bombarded by these messages (each trace call generates several lines):

[34352:0406/075851.692:ERROR:CONSOLE(6)] "console.assert", source: devtools://devtools/bundled/panels/console/console.js (6)

I'm unable reproduce this exact message with an electron snippet using electron v18.0.2, but it shows similar message instead:

[5636:0406/083113.750:INFO:CONSOLE(5)] "test", source: file:///C:/Users/dev/AppData/Local/Temp/tmp-34776-vztptWEofKLe/renderer.js (5)
[5636:0406/083113.751:INFO:CONSOLE(7)] "console.groupEnd", source: file:///C:/Users/dev/AppData/Local/Temp/tmp-34776-vztptWEofKLe/renderer.js (7)

so how can I see where that error is coming from (aka devtools://devtools/bundled/panels/console/console.js) and most importantly how to suppress it?

[EDIT]

This seems to have nothing to do with me replacing console.trace. It seems the issue is in electron itself. The last version that didn't have this issue was 18.0.0-alpha.5, since 18.0.0-beta.1 these messages appear. If I clear developer tools console, the messages stop for a while, but after some time they start showing up again with each message in dev tools.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source