color 'src' info red in default bunyan CLI coloring
This commit is contained in:
parent
6f1433c89b
commit
8f1c8adcd7
3 changed files with 11 additions and 4 deletions
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
## bunyan 0.6.9 (not yet released)
|
## 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
|
- Tweak `bunyan` CLI default output to still show an "err" field if it doesn't
|
||||||
have a "stack" attribute.
|
have a "stack" attribute.
|
||||||
|
|
||||||
|
|
|
@ -380,6 +380,7 @@ function handleLogLine(line, opts, stylize) {
|
||||||
} else {
|
} else {
|
||||||
src = format(" (%s:%d)", s.file, s.line);
|
src = format(" (%s:%d)", s.file, s.line);
|
||||||
}
|
}
|
||||||
|
src = stylize(src, 'green');
|
||||||
}
|
}
|
||||||
delete rec.src;
|
delete rec.src;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
var Logger = require('../lib/bunyan');
|
var Logger = require('../lib/bunyan');
|
||||||
|
|
||||||
// Basic usage.
|
// Basic usage.
|
||||||
var log = new Logger({name: "myapp", level: "info"});
|
var log = new Logger({name: "myapp", level: "info", src: true});
|
||||||
|
|
||||||
// isInfoEnabled replacement
|
// isInfoEnabled replacement
|
||||||
console.log("log.info() is:", log.info())
|
console.log("log.info() is:", log.info())
|
||||||
|
@ -12,11 +12,11 @@ log.info("hi", "trent");
|
||||||
log.info("hi %s there", true);
|
log.info("hi %s there", true);
|
||||||
|
|
||||||
// First arg as an object adds fields to the log record.
|
// 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.
|
// Shows `log.child(...)` to specialize a logger for a sub-component.
|
||||||
console.log("\n\n")
|
console.log("\n")
|
||||||
|
|
||||||
function Wuzzle(options) {
|
function Wuzzle(options) {
|
||||||
this.log = options.log;
|
this.log = options.log;
|
||||||
|
@ -30,4 +30,3 @@ Wuzzle.prototype.woos = function () {
|
||||||
var wuzzle = new Wuzzle({log: log.child({component: "wuzzle"})});
|
var wuzzle = new Wuzzle({log: log.child({component: "wuzzle"})});
|
||||||
wuzzle.woos();
|
wuzzle.woos();
|
||||||
log.info("done with the wuzzle")
|
log.info("done with the wuzzle")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue