Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
需要传入当前引用日志模块的(命名空间:作者名),以便在多个模块集成时,区分日志来源。
var log = require('tapc-log')('a:author');
log.start() // 如果需要改写流,才需要调用此方法,tap插件才能使用,gulp插件不要使用该方法
log.warn('aa');
example:
log.all('xxxxx')
log.debug('xxxxx')
log.info('xxxxx')
log.warn('xxxxx')
log.error('xxxxx')
ps:log.error 会输出模块的author。
log.setDebug(true)
ps:只有在debug模式下,log.all和log.debug的内容才进行输出,log内容会被写入本地(process.env.HOME,'.tap','tap.log')。
只有输出内容中符合
console.log('[info]xxx');
console.log('(info)xxx');
console.log('[warn]xxx');
console.error('(error)xxx');
这类的才能被匹配到对应的日志级别,其他不被捕获的log信息,stdout流的都当做info处理,stderr流的都当做err处理
log.stdoutPut(false);
不想被输出的内容
log.stdoutPut(true);
关掉以后记得开启,不然后续所有内容都无法输出。
log.plain('xxxxx');
A:当spawn启动一个依赖于log模块的插件,需要指定他的stdio为pipe,如果不指定,无法正确识别作者名。
A:使用如下方法
var ps = spawn('node', ['./b.js'], {
cwd:process.cwd(),
env:process.env,
stdio:'pipe'
});
ps.stdout.on('data', function(data) {
log.plain(data);
})
FAQs
Logger for tapc
The npm package tapc-log receives a total of 1 weekly downloads. As such, tapc-log popularity was classified as not popular.
We found that tapc-log demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.