Replace window.console with console in order to support node

This commit is contained in:
Tyler Long 2017-04-16 09:37:05 +08:00
parent 538d2c2b83
commit a730225700
2 changed files with 6 additions and 5 deletions

View File

@ -74,19 +74,19 @@ var fatal = function () {}
*/
exports.setLogLevel = function (level) {
if (level < 6) {
exports.Log.fatal = window.console.debug.bind(window.console, format('FATAL'), 'color:grey;', 'color: red;')
exports.Log.fatal = console.debug.bind(console, format('FATAL'), 'color:grey;', 'color: red;')
}
if (level < 5) {
exports.Log.error = window.console.debug.bind(window.console, format('ERROR'), 'color:grey;', 'color: red;')
exports.Log.error = console.debug.bind(console, format('ERROR'), 'color:grey;', 'color: red;')
}
if (level < 4) {
exports.Log.warn = window.console.debug.bind(window.console, format('WARN'), 'color:grey;', 'color: orange;')
exports.Log.warn = console.debug.bind(console, format('WARN'), 'color:grey;', 'color: orange;')
}
if (level < 3) {
exports.Log.info = window.console.debug.bind(window.console, format('INFO'), 'color:grey;', 'color: info;')
exports.Log.info = console.debug.bind(console, format('INFO'), 'color:grey;', 'color: info;')
}
if (level < 2) {
exports.Log.debug = window.console.debug.bind(window.console, format('DEBUG'), 'color:grey;', 'color: green;')
exports.Log.debug = console.debug.bind(console, format('DEBUG'), 'color:grey;', 'color: green;')
}
}

View File

@ -1,3 +1,4 @@
- Upgrade d3 to version 4
- use external d3-textwrap library
- Problem is it's for d3 v4 only
- node console output colors like Chrome console