You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
636 B

import log from 'loglevel';
import chalk from './chalk';
import prefix from 'loglevel-plugin-prefix';
const colors: any = {
TRACE: chalk.magenta,
DEBUG: chalk.cyan,
INFO: chalk.blue,
WARN: chalk.yellow,
ERROR: chalk.red,
};
prefix.reg(log);
log.enableAll();
prefix.apply(log, {
format(level, name, timestamp) {
return `${chalk.gray(`[${timestamp}]`)} ${colors[level.toUpperCase()](level)} ${chalk.green(
`${name}:`
)}`;
},
});
// prefix.apply(log.getLogger('critical'), {
// format(level, name, timestamp) {
// return chalk.red.bold(`[${timestamp}] ${level} ${name}:`);
// },
// });
export { log };