Merge pull request #89 from bcantrill/master

issue #88: should be able to efficiently combine "-l" with "-p *"
This commit is contained in:
Trent Mick 2013-05-17 02:10:16 -07:00
commit 9681341945

View file

@ -177,7 +177,7 @@ function printHelp() {
p(' -h, --help print this help info and exit'); p(' -h, --help print this help info and exit');
p(' --version print version of this command and exit'); p(' --version print version of this command and exit');
p(''); p('');
p('Dtrace options (only on dtrace-supporting platforms):'); p('DTrace options (only on dtrace-supporting platforms):');
p(' -p PID Process bunyan:log-* probes from the process'); p(' -p PID Process bunyan:log-* probes from the process');
p(' with the given PID. Can be used multiple times,'); p(' with the given PID. Can be used multiple times,');
p(' or specify all processes with "*", or a set of'); p(' or specify all processes with "*", or a set of');
@ -1102,7 +1102,22 @@ function processPids(opts, stylize, callback) {
} }
var probes = pids.map(function (pid) { var probes = pids.map(function (pid) {
if (!opts.level)
return format('bunyan%s:::log-*', pid); return format('bunyan%s:::log-*', pid);
var rval = [], l;
for (l in levelFromName) {
if (levelFromName[l] >= opts.level)
rval.push(format('bunyan%s:::log-%s', pid, l));
}
if (rval.length != 0)
return rval.join(',');
warn('bunyan: error: level (%d) exceeds maximum logging level',
opts.level);
return drainStdoutAndExit(1);
}).join(','); }).join(',');
var argv = ['dtrace', '-Z', '-x', 'strsize=4k', '-qn', var argv = ['dtrace', '-Z', '-x', 'strsize=4k', '-qn',
'-x', 'switchrate=10hz', '-x', 'switchrate=10hz',