mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
#931 Compliacne with code standard
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import moment from 'moment-mini'
|
||||
import moment from 'moment-mini';
|
||||
|
||||
export const LEVELS = {
|
||||
debug: 1,
|
||||
@@ -6,7 +6,7 @@ export const LEVELS = {
|
||||
warn: 3,
|
||||
error: 4,
|
||||
fatal: 5
|
||||
}
|
||||
};
|
||||
|
||||
export const logger = {
|
||||
debug: () => {},
|
||||
@@ -14,32 +14,32 @@ export const logger = {
|
||||
warn: () => {},
|
||||
error: () => {},
|
||||
fatal: () => {}
|
||||
}
|
||||
};
|
||||
|
||||
export const setLogLevel = function (level) {
|
||||
logger.debug = () => {}
|
||||
logger.info = () => {}
|
||||
logger.warn = () => {}
|
||||
logger.error = () => {}
|
||||
logger.fatal = () => {}
|
||||
export const setLogLevel = function(level) {
|
||||
logger.debug = () => {};
|
||||
logger.info = () => {};
|
||||
logger.warn = () => {};
|
||||
logger.error = () => {};
|
||||
logger.fatal = () => {};
|
||||
if (level <= LEVELS.fatal) {
|
||||
logger.fatal = console.log.bind(console, '\x1b[35m', format('FATAL'))
|
||||
logger.fatal = console.log.bind(console, '\x1b[35m', format('FATAL'));
|
||||
}
|
||||
if (level <= LEVELS.error) {
|
||||
logger.error = console.log.bind(console, '\x1b[31m', format('ERROR'))
|
||||
logger.error = console.log.bind(console, '\x1b[31m', format('ERROR'));
|
||||
}
|
||||
if (level <= LEVELS.warn) {
|
||||
logger.warn = console.log.bind(console, `\x1b[33m`, format('WARN'))
|
||||
logger.warn = console.log.bind(console, `\x1b[33m`, format('WARN'));
|
||||
}
|
||||
if (level <= LEVELS.info) {
|
||||
logger.info = console.log.bind(console, '\x1b[34m', format('INFO'))
|
||||
logger.info = console.log.bind(console, '\x1b[34m', format('INFO'));
|
||||
}
|
||||
if (level <= LEVELS.debug) {
|
||||
logger.debug = console.log.bind(console, '\x1b[32m', format('DEBUG'))
|
||||
logger.debug = console.log.bind(console, '\x1b[32m', format('DEBUG'));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const format = (level) => {
|
||||
const time = moment().format('HH:mm:ss.SSS')
|
||||
return `${time} : ${level} : `
|
||||
}
|
||||
const format = level => {
|
||||
const time = moment().format('HH:mm:ss.SSS');
|
||||
return `${time} : ${level} : `;
|
||||
};
|
||||
|
Reference in New Issue
Block a user