log1

2019-02-14 admin

log1是什么

什么是log1,log for global、env or debug

log1使用教程帮助文档

log1 = log for global、env or debug

Build npm version

make all console.xx to global

global log

require('log1')

log('global log')

global log with env

require('log1')()

log('global log')

when NODE_ENV=production,will not print any log

export NODE_ENV=production && node test.js

otherwise,print log

global log disable

require('log1')(true)

log('global log')

this will not print any log

export NODE_ENV=production && node test/log-disable.js

use debug module

https://github.com/visionmedia/debug

use log1 namespace as default

require('log1')()

var name = 'My App'

debug('booting %s', name);

exec show debug info

$ export DEBUG=log1 && node test/debug.js
log1 booting My App +0ms

use custom namespace

require('log1')(true, 'namespace')

var name = 'My App'

debug('booting %s', name);

exec show debug info

$ export DEBUG=namespace && node test/custom-debug.js
namespace custom booting My App +0ms

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-53733.html

文章标题:log1

回到顶部