mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-17 06:20:07 +02:00
Fix style issue of logger.js
This commit is contained in:
@@ -42,7 +42,9 @@
|
|||||||
"ignore": [
|
"ignore": [
|
||||||
"**/parser/*.js",
|
"**/parser/*.js",
|
||||||
"src/d3.js",
|
"src/d3.js",
|
||||||
"dist/*.js"
|
"dist/**/*.js",
|
||||||
|
"docs/**/*.js",
|
||||||
|
"editor/**/*.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@@ -10,16 +10,16 @@
|
|||||||
* => [2011-3-3T20:24:4.810 error (5021)] booom
|
* => [2011-3-3T20:24:4.810 error (5021)] booom
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const LEVELS = {
|
// const LEVELS = {
|
||||||
debug: 1,
|
// debug: 1,
|
||||||
info: 2,
|
// info: 2,
|
||||||
warn: 3,
|
// warn: 3,
|
||||||
error: 4,
|
// error: 4,
|
||||||
fatal: 5,
|
// fatal: 5,
|
||||||
default: 5
|
// default: 5
|
||||||
}
|
// }
|
||||||
|
|
||||||
var defaultLevel = LEVELS.error
|
// var defaultLevel = LEVELS.error
|
||||||
|
|
||||||
// exports.setLogLevel = function (level) {
|
// exports.setLogLevel = function (level) {
|
||||||
// defaultLevel = level;
|
// defaultLevel = level;
|
||||||
@@ -73,17 +73,20 @@ var fatal = function () {}
|
|||||||
* * fatal: 5
|
* * fatal: 5
|
||||||
*/
|
*/
|
||||||
exports.setLogLevel = function (level) {
|
exports.setLogLevel = function (level) {
|
||||||
switch (level) {
|
if (level < 6) {
|
||||||
case 1:
|
exports.Log.fatal = window.console.debug.bind(window.console, format('FATAL'), 'color:grey;', 'color: red;')
|
||||||
exports.Log.debug = window.console.debug.bind(window.console, format('DEBUG', name), 'color:grey;', 'color: green;')
|
}
|
||||||
case 2:
|
if (level < 5) {
|
||||||
exports.Log.info = window.console.debug.bind(window.console, format('INFO', name), 'color:grey;', 'color: info;')
|
exports.Log.error = window.console.debug.bind(window.console, format('ERROR'), 'color:grey;', 'color: red;')
|
||||||
case 3:
|
}
|
||||||
exports.Log.warn = window.console.debug.bind(window.console, format('INFO', name), 'color:grey;', 'color: orange;')
|
if (level < 4) {
|
||||||
case 4:
|
exports.Log.warn = window.console.debug.bind(window.console, format('WARN'), 'color:grey;', 'color: orange;')
|
||||||
exports.Log.error = window.console.debug.bind(window.console, format('ERROR', name), 'color:grey;', 'color: red;')
|
}
|
||||||
case 5:
|
if (level < 3) {
|
||||||
exports.Log.fatal = window.console.debug.bind(window.console, format('FATAL', name), 'color:grey;', 'color: red;')
|
exports.Log.info = window.console.debug.bind(window.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;')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user