Skip to content

Commit

Permalink
Force debug module terminal colors
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
artemave committed Jul 2, 2019
1 parent 5e73d56 commit 673b218
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions renderer/console.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
const { remote } = require('electron')
const remoteConsole = remote.require('console')

console.log = (...args) => {
remoteConsole.log(...args)
}
process.env.DEBUG_COLORS_NODE = 'on'

console.dir = (...args) => {
remoteConsole.dir(...args)
}
;[
'log',
'info',
'warn',
'error',
'dir',
'table',
'count',
'countReset',
'group',
'groupCollapse',
'groupEnd',
'trace',
'time',
'timeEnd',
'timeLog'
].forEach(method => {
console[method] = (...args) => {
remoteConsole[method](...args)
}
})

0 comments on commit 673b218

Please sign in to comment.