Skip to content

zooey1184/log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

说明

安装

yarn add @zooey1184/log
# or
npm i @zooey1184/log

类型

默认定义类型

类型 颜色
success green
warn yellow
error red
tip cyan
info blue
bold 加粗
underline 下划线
xxx(其他未定义) white

使用

// log === console.log   log.error ==> console.error
const log = require('@zooey1184/log')

log('this is normal log style')
// 如果拆分多个,则第一个会设置成有背景色的提示
log.success('success', 'this is success log style')
// 如果字符串中有{{}}  包裹  包裹内部使用颜色  其他为白色
log.tip('this is {{tip}} log style')
log.warn('warn', 'this is {{warn}} ', 'log style')
log.xx('xxxx', 'not defined this function or property show this default style')
// bold | underline
log.bold('this is bold style')

// hex 使用hex 函数 颜色为hex|rgb 样式
log.hex('#d43f33')('this is hex style')
log.hex('rgb(88,189,144)')(' rgb ','this is rgb style\n')

// 除此之外  你还可以自定义 或者覆盖原有样式
log.good = '#CD0074'
log.good(' GOOD ', 'this is {{good}} style')
// 支持rgb
log.bad = 'rgb(120,189,144)'
log.bad('this is bad style')

example

git 传送门 npm 传送门

不支持 log.rgb(...)(xxx) 你可以使用 log.hex('rgb(88,189,144)')