bunyan -p '*'

This commit is contained in:
Trent Mick 2012-11-06 12:55:02 -08:00
parent 6869931a60
commit 918c8081ca
2 changed files with 7 additions and 2 deletions

View file

@ -2,6 +2,7 @@
## bunyan 0.16.5 (not yet released)
- Allow `bunyan -p '*'` to capture bunyan dtrace probes from **all** processes.
- issue #55: Add support for `BUNYAN_NO_COLOR` environment variable to
turn off all output coloring. This is still overridden by the `--color`
and `--no-color` options.

View file

@ -403,7 +403,11 @@ function parseArgv(argv) {
var pidArg = args.shift();
var pid = +(pidArg);
if (isNaN(pid)) {
throw new Error(format('invalid pid: "%s"', pidArg));
if (pidArg === '*') {
pid = '*'
} else {
throw new Error(format('invalid pid: "%s"', pidArg));
}
}
parsed.pid = pid;
break;
@ -912,7 +916,7 @@ function processStdin(opts, stylize, callback) {
function processPid(opts, stylize, callback) {
var leftover = ""; // Left-over partial line from last chunk.
var argv = ['dtrace', '-Z', '-x', 'strsize=4k', '-qn',
format('bunyan%d:::log-*{printf("%s", copyinstr(arg0))}', opts.pid)];
format('bunyan%s:::log-*{printf("%s", copyinstr(arg0))}', opts.pid)];
var dtrace = spawn(argv[0], argv.slice(1),
// Share the stderr handle to have error output come
// straight through. Only supported in v0.8+.