@bluesyoung/logger
v0.1.0
Published
log format
Downloads
34
Maintainers
Readme
基于 consola
包装的日志格式化库
安装
npm i @bluesyoung/logger
yarn add @bluesyoung/logger
pnpm add @bluesyoung/logger
使用
import { useYoungLogger } from '@bluesyoung/logger';
// 默认劫持 console
const { logger, consola } = useYoungLogger();
日志等级配置
# 通过环境变量配置
# 只展示 error
CONSOLA_LEVEL=0
# 展示 error + warn
CONSOLA_LEVEL=1
# 展示 error + warn + log
CONSOLA_LEVEL=2
# 展示 error + warn + log + info(默认)
CONSOLA_LEVEL=3
# 展示 error + warn + log + info + debug
CONSOLA_LEVEL=4
# 展示 error + warn + log + info + debug + trace
CONSOLA_LEVEL=5