This commit is contained in:
Trent Mick 2012-01-31 14:47:06 -08:00
parent 44d280d688
commit fb1ed4f4ee
2 changed files with 19 additions and 1 deletions

View file

@ -69,6 +69,25 @@ streams at different levels**.
]
});
A `log.clone(...)` is provided to specialize a logger for a sub-component.
The following will have log records from "Wuzzle" instances use exactly the
same config as its parent, plus include the "component" field.
var log = new Logger(...);
...
function Wuzzle(options) {
this.log = options.log;
this.log.info("creating a wuzzle")
}
Wuzzle.prototype.woos = function () {
this.log.warn("This wuzzle is woosey.")
}
var wuzzle = new Wuzzle({log: log.clone({component: "wuzzle"})});
wuzzle.woos();
log.info("done with the wuzzle")
# Future

View file

@ -1,4 +1,3 @@
- add `clone` to readme
- serializer support (i.e. repr of a restify request obj):
server.js example
restify-server.js example