English
简体中文
simple integration of console printing, displaying the type, content, time, etc. of printed content, distinguishing packaging and development environments
// umd
<script src="qlog.umd.js"></script>
const qlogObj = new qlog({
level:qlog.level.VerBose,
locale:'zh-cn',
zIndex:99
});
// es
import qlog from 'qlog';
const qlogObj = new qlog({
level:qlog.level.VerBose,
locale:'zh-cn',
zIndex:99,
});
// qlogObj.filter(3);
qlogObj.log('测试',123,{zIndex:100});
qlogObj.info('测试33',555);
qlogObj.warn('测试33',555);
qlogObj.error('测试33',555);
qlogObj.log('测试3555',[{t:1,b:2,c:3},123,[{t:1,b:2,c:3},{t:1,b:2,c:3}]],{zIndex:100,style:'font-size:20px'});
| 参数名 |
作用 |
是否必填 |
默认值 |
| build |
判断是否为打包环境,true为打包环境,false为开发环境 |
否 |
false |
| level |
打印等级 |
否 |
qlog.Level.VerBose |
| locale |
语言 |
否 |
en |
| zIndex |
打印层级,后续打印只显示比初始层级高的打印内容 |
否 |
1 |
| VerBoseStyle |
VerBose层级打印样式 |
否 |
undefined |
| InfoStyle |
Info层级打印样式 |
否 |
undefined |
| WarningStyle |
Warning层级打印样式 |
否 |
undefined |
| ErrorStyle |
Error层级打印样式 |
否 |
undefined |
| format |
显示时间格式(可以参考dayjs文档) |
否 |
undefined |
| parameter |
type |
whether |
| key |
string | number |
false(Suggest filling in different key values each time to facilitate subsequent filtering) |
| message |
any |
false |
| param |
LogParam = {
style?:string,
zIndex?:number
}
|
false |
| parameter |
type |
whether |
| key |
string | number |
true |