Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

issue #55: add BUNYAN_NO_COLOR envvar support

  • Loading branch information...
commit 6869931a606b37eae5f41180d0d228f550fe3916 1 parent 68b554e
Trent Mick authored
4 CHANGES.md
View
@@ -2,7 +2,9 @@
## 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
14 bin/bunyan
View
@@ -191,6 +191,10 @@ function printHelp() {
console.log(" %s %d", n, levelFromName[name]);
});
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("Please report bugs to <https://github.com/trentm/node-bunyan/issues>.");
}
@@ -314,7 +318,7 @@ function parseArgv(argv) {
var parsed = {
args: [],
help: false,
- color: process.stdout.isTTY,
+ color: null,
outputMode: OM_PAUL,
jsonIndent: 2,
level: null,
@@ -1114,6 +1118,14 @@ function main(argv) {
opts.pid, opts.args.join(' '));
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 retval = 0;
6 docs/bunyan.1
View
@@ -197,6 +197,12 @@ Each of these probes has a single argument: the string that would be written to
.P
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"
\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"\.
.
8 docs/bunyan.1.html
View
@@ -66,6 +66,7 @@
<a href="#LOG-LEVELS">LOG LEVELS</a>
<a href="#OUTPUT-FORMATS">OUTPUT FORMATS</a>
<a href="#DTRACE-SUPPORT">DTRACE SUPPORT</a>
+ <a href="#ENVIRONMENT">ENVIRONMENT</a>
<a href="#PROJECT-BUGS">PROJECT &amp; BUGS</a>
<a href="#LICENSE">LICENSE</a>
<a href="#COPYRIGHT">COPYRIGHT</a>
@@ -230,6 +231,13 @@ <h2 id="DTRACE-SUPPORT">DTRACE SUPPORT</h2>
<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 &amp; BUGS</h2>
<p><code>bunyan</code> is written in JavaScript and requires node.js (<code>node</code>). The project
6 docs/bunyan.1.ronn
View
@@ -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.
+## ENVIRONMENT
+
+ * `BUNYAN_NO_COLOR`:
+ Set to a non-empty value to force no output coloring. See '--no-color'.
+
+
## PROJECT & BUGS
`bunyan` is written in JavaScript and requires node.js (`node`). The project
Please sign in to comment.
Something went wrong with that request. Please try again.