improve intro to the 'log.info(...)' API

master
Trent Mick 2012-02-17 11:22:14 -08:00
parent 8efd876403
commit 0d713a46d8
1 changed files with 8 additions and 4 deletions

View File

@ -35,13 +35,17 @@ format version) are added for you.
The full `log.{trace|debug|...|fatal}(...)` API is:
log.info(); // Returns a boolean: is the "info" level enabled?
log.info(err); // Log an `Error` instance, adds "err" key with exception details
// (including the stack) and sets "msg" to the exception message.
// A special case, b/c logging errors should be easy.
log.info('hi'); // Log a simple string message.
log.info('hi'); // Log a simple string message.
log.info('hi %s', bob, anotherVar); // Uses `util.format` for msg formatting.
log.info({foo: 'bar'}, 'hi'); // Adds "foo" field to log record.
log.info(err); // Special case to log an `Error` instance, adds "err"
// key with exception details (including the stack) and
// sets "msg" to the exception message.
log.info(err, 'more on this: %s', more);
// ... or you can specify the "msg".
## bunyan tool