issue #131 Allow `log.info(<number>)` and, most importantly, don't crash on that.

master
Trent Mick 2014-04-03 15:59:41 -07:00
parent a689ca171e
commit 36f7e51a65
4 changed files with 6 additions and 3 deletions

View File

@ -8,6 +8,8 @@ Known issues:
## bunyan 0.22.2 (not yet released)
- #131 Allow `log.info(<number>)` and, most importantly, don't crash on that.
- Update 'mv' optional dep to latest.

View File

@ -84,7 +84,7 @@ full API is:
// This is equivalent to `log.isInfoEnabled()` or
// `log.isEnabledFor(INFO)` in log4j.
log.info('hi'); // Log a simple string message.
log.info('hi'); // Log a simple string message (or number).
log.info('hi %s', bob, anotherVar); // Uses `util.format` for msg formatting.
log.info({foo: 'bar'}, 'hi');

View File

@ -834,7 +834,7 @@ function emitRecord(rec, line, opts, stylize) {
var s = '';
if (res.header) {
s += res.header.trimRight();
} else if (typeof(res.headers) === 'string') {
} else if (typeof (res.headers) === 'string') {
s += res.headers.trimRight();
} else if (res.headers) {
if (res.statusCode) {

View File

@ -769,7 +769,8 @@ function mkLogEmitter(minLevel) {
} else {
msgArgs = Array.prototype.slice.call(args, 1);
}
} else if (typeof (args[0]) === 'string') {
} else if (typeof (args[0]) === 'string' ||
typeof (args[0]) === 'number') {
// `log.<level>(msg, ...)`
fields = null;
msgArgs = Array.prototype.slice.call(args);