Permalink
Browse files

color 'src' info red in default bunyan CLI coloring

  • Loading branch information...
1 parent 6f1433c commit 8f1c8adcd7056ed1c7ee09597b294689282471b2 @trentm committed Apr 10, 2012
Showing with 11 additions and 4 deletions.
  1. +7 −0 CHANGES.md
  2. +1 −0 bin/bunyan
  3. +3 −4 examples/hi.js
View
@@ -2,6 +2,13 @@
## bunyan 0.6.9 (not yet released)
+- Change `bunyan` CLI default output to color "src" info red. Before the "src"
+ information was uncolored. The "src" info is the filename, line number and
+ function name resulting from using `src: true` in `Logger` creation. I.e.,
+ the `(/Users/trentm/tm/node-bunyan/examples/hi.js:10)` in:
+
+ [2012-04-10T22:28:58.237Z] INFO: myapp/39339 on banana.local (/Users/trentm/tm/node-bunyan/examples/hi.js:10): hi
+
- Tweak `bunyan` CLI default output to still show an "err" field if it doesn't
have a "stack" attribute.
View
@@ -380,6 +380,7 @@ function handleLogLine(line, opts, stylize) {
} else {
src = format(" (%s:%d)", s.file, s.line);
}
+ src = stylize(src, 'green');
}
delete rec.src;
View
@@ -1,7 +1,7 @@
var Logger = require('../lib/bunyan');
// Basic usage.
-var log = new Logger({name: "myapp", level: "info"});
+var log = new Logger({name: "myapp", level: "info", src: true});
// isInfoEnabled replacement
console.log("log.info() is:", log.info())
@@ -12,11 +12,11 @@ log.info("hi", "trent");
log.info("hi %s there", true);
// First arg as an object adds fields to the log record.
-log.info({foo:"bar"}, "hi %d", 1, "two", 3);
+log.info({foo:"bar", multiline:"one\ntwo\nthree"}, "hi %d", 1, "two", 3);
// Shows `log.child(...)` to specialize a logger for a sub-component.
-console.log("\n\n")
+console.log("\n")
function Wuzzle(options) {
this.log = options.log;
@@ -30,4 +30,3 @@ Wuzzle.prototype.woos = function () {
var wuzzle = new Wuzzle({log: log.child({component: "wuzzle"})});
wuzzle.woos();
log.info("done with the wuzzle")
-

0 comments on commit 8f1c8ad

Please sign in to comment.