@ exodus/ logger (英语)
一个简单的记录器,所有的东西,海德拉。 使用控制台打印信件 .
使用量
首先,创建一个日志实例 。 您可以在此提供可选的命名空间 。 每个消息都会 以此字符串为前缀.
import createLogger from '@exodus/logger'
const logger = createLogger()
const namespacedLogger = createLogger('dumbledore')
一旦有实例,就使用任何日志级方法.
目前支持以下日志级别:
trace, (中文(简体) ), debug, (中文(简体) ), log, (中文(简体) ), info, (中文(简体) ), warn, (中文(简体) ), error
import createLogger from '@exodus/logger'
const logger = createLogger('dumbledore')
logger.log('It is our choices, Harry, that show what we truly are, far more than our abilities.')
// console.log: [dumbledore] It is our choices, Harry, that show what we truly are, far more than our abilities.
logger.info('We are only as strong as we are united, as weak as we are divided.')
// console.info: [dumbledore:info] We are only as strong as we are united, as weak as we are divided.