Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
40
my-app/node_modules/critters/src/util.js
generated
vendored
Executable file
40
my-app/node_modules/critters/src/util.js
generated
vendored
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
import chalk from 'chalk';
|
||||
|
||||
const LOG_LEVELS = ['trace', 'debug', 'info', 'warn', 'error', 'silent'];
|
||||
|
||||
export const defaultLogger = {
|
||||
trace(msg) {
|
||||
console.trace(msg);
|
||||
},
|
||||
|
||||
debug(msg) {
|
||||
console.debug(msg);
|
||||
},
|
||||
|
||||
warn(msg) {
|
||||
console.warn(chalk.yellow(msg));
|
||||
},
|
||||
|
||||
error(msg) {
|
||||
console.error(chalk.bold.red(msg));
|
||||
},
|
||||
|
||||
info(msg) {
|
||||
console.info(chalk.bold.blue(msg));
|
||||
},
|
||||
|
||||
silent() {}
|
||||
};
|
||||
|
||||
export function createLogger(logLevel) {
|
||||
const logLevelIdx = LOG_LEVELS.indexOf(logLevel);
|
||||
|
||||
return LOG_LEVELS.reduce((logger, type, index) => {
|
||||
if (index >= logLevelIdx) {
|
||||
logger[type] = defaultLogger[type];
|
||||
} else {
|
||||
logger[type] = defaultLogger.silent;
|
||||
}
|
||||
return logger;
|
||||
}, {});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue