issue #55: add BUNYAN_NO_COLOR envvar support
This commit is contained in:
parent
68b554e6d3
commit
6869931a60
5 changed files with 36 additions and 2 deletions
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
## bunyan 0.16.5 (not yet released)
|
## bunyan 0.16.5 (not yet released)
|
||||||
|
|
||||||
(nothing yet)
|
- 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.
|
||||||
|
|
||||||
|
|
||||||
## bunyan 0.16.4
|
## bunyan 0.16.4
|
||||||
|
|
14
bin/bunyan
14
bin/bunyan
|
@ -191,6 +191,10 @@ function printHelp() {
|
||||||
console.log(" %s %d", n, levelFromName[name]);
|
console.log(" %s %d", n, levelFromName[name]);
|
||||||
});
|
});
|
||||||
console.log("");
|
console.log("");
|
||||||
|
console.log("Environment Variables:");
|
||||||
|
console.log(" BUNYAN_NO_COLOR Set to a non-empty value to force no output ");
|
||||||
|
console.log(" coloring. See '--no-color'.");
|
||||||
|
console.log("");
|
||||||
console.log("See <https://github.com/trentm/node-bunyan> for more complete docs.");
|
console.log("See <https://github.com/trentm/node-bunyan> for more complete docs.");
|
||||||
console.log("Please report bugs to <https://github.com/trentm/node-bunyan/issues>.");
|
console.log("Please report bugs to <https://github.com/trentm/node-bunyan/issues>.");
|
||||||
}
|
}
|
||||||
|
@ -314,7 +318,7 @@ function parseArgv(argv) {
|
||||||
var parsed = {
|
var parsed = {
|
||||||
args: [],
|
args: [],
|
||||||
help: false,
|
help: false,
|
||||||
color: process.stdout.isTTY,
|
color: null,
|
||||||
outputMode: OM_PAUL,
|
outputMode: OM_PAUL,
|
||||||
jsonIndent: 2,
|
jsonIndent: 2,
|
||||||
level: null,
|
level: null,
|
||||||
|
@ -1114,6 +1118,14 @@ function main(argv) {
|
||||||
opts.pid, opts.args.join(' '));
|
opts.pid, opts.args.join(' '));
|
||||||
return drainStdoutAndExit(1);
|
return drainStdoutAndExit(1);
|
||||||
}
|
}
|
||||||
|
if (opts.color === null) {
|
||||||
|
if (process.env.BUNYAN_NO_COLOR &&
|
||||||
|
process.env.BUNYAN_NO_COLOR.length > 0) {
|
||||||
|
opts.color = false;
|
||||||
|
} else {
|
||||||
|
opts.color = process.stdout.isTTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
var stylize = (opts.color ? stylizeWithColor : stylizeWithoutColor);
|
var stylize = (opts.color ? stylizeWithColor : stylizeWithoutColor);
|
||||||
|
|
||||||
var retval = 0;
|
var retval = 0;
|
||||||
|
|
|
@ -197,6 +197,12 @@ Each of these probes has a single argument: the string that would be written to
|
||||||
.P
|
.P
|
||||||
See \fIhttps://github\.com/trentm/node\-bunyan#dtrace\-support\fR for more details\.
|
See \fIhttps://github\.com/trentm/node\-bunyan#dtrace\-support\fR for more details\.
|
||||||
.
|
.
|
||||||
|
.SH "ENVIRONMENT"
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
\fBBUNYAN_NO_COLOR\fR
|
||||||
|
Set to a non\-empty value to force no output coloring\. See \'\-\-no\-color\'\.
|
||||||
|
.
|
||||||
.SH "PROJECT & BUGS"
|
.SH "PROJECT & BUGS"
|
||||||
\fBbunyan\fR is written in JavaScript and requires node\.js (\fBnode\fR)\. The project lives at \fIhttps://github\.com/trentm/node\-bunyan\fR and is published to npm as "bunyan"\.
|
\fBbunyan\fR is written in JavaScript and requires node\.js (\fBnode\fR)\. The project lives at \fIhttps://github\.com/trentm/node\-bunyan\fR and is published to npm as "bunyan"\.
|
||||||
.
|
.
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
<a href="#LOG-LEVELS">LOG LEVELS</a>
|
<a href="#LOG-LEVELS">LOG LEVELS</a>
|
||||||
<a href="#OUTPUT-FORMATS">OUTPUT FORMATS</a>
|
<a href="#OUTPUT-FORMATS">OUTPUT FORMATS</a>
|
||||||
<a href="#DTRACE-SUPPORT">DTRACE SUPPORT</a>
|
<a href="#DTRACE-SUPPORT">DTRACE SUPPORT</a>
|
||||||
|
<a href="#ENVIRONMENT">ENVIRONMENT</a>
|
||||||
<a href="#PROJECT-BUGS">PROJECT & BUGS</a>
|
<a href="#PROJECT-BUGS">PROJECT & BUGS</a>
|
||||||
<a href="#LICENSE">LICENSE</a>
|
<a href="#LICENSE">LICENSE</a>
|
||||||
<a href="#COPYRIGHT">COPYRIGHT</a>
|
<a href="#COPYRIGHT">COPYRIGHT</a>
|
||||||
|
@ -230,6 +231,13 @@ the log message is less than that of any stream.</p>
|
||||||
|
|
||||||
<p>See <a href="https://github.com/trentm/node-bunyan#dtrace-support" data-bare-link="true">https://github.com/trentm/node-bunyan#dtrace-support</a> for more details.</p>
|
<p>See <a href="https://github.com/trentm/node-bunyan#dtrace-support" data-bare-link="true">https://github.com/trentm/node-bunyan#dtrace-support</a> for more details.</p>
|
||||||
|
|
||||||
|
<h2 id="ENVIRONMENT">ENVIRONMENT</h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><code>BUNYAN_NO_COLOR</code></dt><dd>Set to a non-empty value to force no output coloring. See '--no-color'.</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
<h2 id="PROJECT-BUGS">PROJECT & BUGS</h2>
|
<h2 id="PROJECT-BUGS">PROJECT & BUGS</h2>
|
||||||
|
|
||||||
<p><code>bunyan</code> is written in JavaScript and requires node.js (<code>node</code>). The project
|
<p><code>bunyan</code> is written in JavaScript and requires node.js (<code>node</code>). The project
|
||||||
|
|
|
@ -156,6 +156,12 @@ the log message is less than that of any stream.
|
||||||
See <https://github.com/trentm/node-bunyan#dtrace-support> for more details.
|
See <https://github.com/trentm/node-bunyan#dtrace-support> for more details.
|
||||||
|
|
||||||
|
|
||||||
|
## ENVIRONMENT
|
||||||
|
|
||||||
|
* `BUNYAN_NO_COLOR`:
|
||||||
|
Set to a non-empty value to force no output coloring. See '--no-color'.
|
||||||
|
|
||||||
|
|
||||||
## PROJECT & BUGS
|
## PROJECT & BUGS
|
||||||
|
|
||||||
`bunyan` is written in JavaScript and requires node.js (`node`). The project
|
`bunyan` is written in JavaScript and requires node.js (`node`). The project
|
||||||
|
|
Loading…
Reference in a new issue