@4a/asp

color log, 染色日志

Usage no npm install needed!

<script type="module">
  import 4aAsp from 'https://cdn.skypack.dev/@4a/asp';
</script>

README

asp

染色日志,推荐配合iTerm使用,非标准日志模块,方便日志聚焦

Install

npm i @4a/asp

Usage

const asp = require('@4a/asp')

asp.gray('message', { app: '@4a/asp' })
asp.log('message', { app: '@4a/asp' })
asp.info('message', { app: '@4a/asp' })
asp.debug('message', { app: '@4a/asp' })
asp.warn('message', { app: '@4a/asp' })
asp.error('message', { app: '@4a/asp' })

Preview

@4a/asp:preview

class Asp

const Asp = require('@4a/asp').Asp

// 开启日志类型标记,默认关闭
const asp = new Asp(true)

Level

分级显示

level=0 node app.js # only error
level=1 node app.js # warn, error
level=2 node app.js # debug, warn, error
level=3 node app.js # info, debug, warn, error
level=4 node app.js # log, info, debug, warn, error
level=5 node app.js # all

level

{
    error: 0,
    warn: 1,
    debug: 2,
    info: 3,
    log: 4,
    gray: 5,
}

Example

node demo.js