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

This commit is contained in:
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

@ -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);