Skip to content

Commit 673b218

Browse files
committed
Force debug module terminal colors
When/if [this pr](debug-js/debug#713) is merged, this change will allow to correctly output terminal colors from the [debug module](https://www.npmjs.com/package/debug) Also here: proxy all relevant renderer `console.*` methods to the main process `console`.
1 parent 5e73d56 commit 673b218

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

renderer/console.js

+22-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
const { remote } = require('electron')
22
const remoteConsole = remote.require('console')
33

4-
console.log = (...args) => {
5-
remoteConsole.log(...args)
6-
}
4+
process.env.DEBUG_COLORS_NODE = 'on'
75

8-
console.dir = (...args) => {
9-
remoteConsole.dir(...args)
10-
}
6+
;[
7+
'log',
8+
'info',
9+
'warn',
10+
'error',
11+
'dir',
12+
'table',
13+
'count',
14+
'countReset',
15+
'group',
16+
'groupCollapse',
17+
'groupEnd',
18+
'trace',
19+
'time',
20+
'timeEnd',
21+
'timeLog'
22+
].forEach(method => {
23+
console[method] = (...args) => {
24+
remoteConsole[method](...args)
25+
}
26+
})

0 commit comments

Comments
 (0)