
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Why another logger? That's a good question!
Example:

ylog 的特点:

ylog.setLevel(levels, mode)
levels 可以是单个 level,也可以是一个 level 数组
mode 可以是 'only' 或 'weight'
only mode: 表示只输出 levels 中指定的级别,其它级别不输出
weight mode: 表示只输出权重__大于等于__所有指定 levels 中的最低权重的级别(默认是此值)
ylog.levelFlag(name, weight, tag)
// 修改
c.levelFlag('ok', 5000, 'ok');
// 添加
c.levelFlag('ok2', 5500, chalk.bold.green('✓'));
很简单,像使用 debug 一样,只是环境变量名从 DEBUG 变成了 YLOG


ylog.styleFlag(name, fn)
name: 是样式名称
fn: 的参数是你执行是填的参数,fn 需要返回一个字符串
// 定义一个简单的换行样式(默认有个 ln,它输出的换行是在左边)
ylog.styleFlag('rightLn', function(str) {
return (str || '') + '\n';
})
// 现在你就可以这样用
ylog.rightLn('are you ok');


有两种方式:
ylog.attr({md: true, time: false, wrap: 80}).log('...')ylog.md.no.time.wrap(80).log('...');你可以使用 ylog.attributes 对像,直接修改属性的默认值,它会影响全局的配置
只要打开全局配置 time 来即可
ylog.attributes.time = true;
配置 ylog.Tag 属性
ylog.Tag.pid.show = true;
var logger = ylog('myNamespace');
logger.on('myNamespace.ok', function() {
});
logger.ok('ok'); // => 会触发上面的监听
logger.info('info'); // => 不会触发上面的监听
var ylog = require('ylog');
var fs = require('fs');
var p = ylog.progress('progress', {theme: 'ascii'});
var basicJob = p.addJob('job 1', 1000, 2);
basicJob.complete(10);
//basicJob progress
var sid = setInterval(function() {
basicJob.complete(100);
}, 500);
// streamJob progress
fs.stat(__filename, function(err, stats) {
if (err) { throw err; }
var streamJob = p.addJob('job 2', stats.size, true);
setTimeout(function() {
fs.createReadStream(__filename).pipe(streamJob).on('data', function() {
// do your thing
});
}, 200)
});
p.on('finished', function(name) {
p.hide();
console.log('finished ' + name);
clearInterval(sid);
});
Copyright (c) 2015 Zhonglei Qiu. Licensed under the MIT license.
FAQs
Why another logger? That's a good question!
The npm package ylog receives a total of 6 weekly downloads. As such, ylog popularity was classified as not popular.
We found that ylog 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.