diff --git a/CHANGES.md b/CHANGES.md index 29b105b..fff8e42 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,8 @@ Known issues: ## bunyan 0.22.2 (not yet released) +- #131 Allow `log.info()` and, most importantly, don't crash on that. + - Update 'mv' optional dep to latest. diff --git a/README.md b/README.md index f79c126..e7daf26 100644 --- a/README.md +++ b/README.md @@ -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'); diff --git a/bin/bunyan b/bin/bunyan index fe34273..b1b6096 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -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) { diff --git a/lib/bunyan.js b/lib/bunyan.js index f4b5c76..0953f42 100644 --- a/lib/bunyan.js +++ b/lib/bunyan.js @@ -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.(msg, ...)` fields = null; msgArgs = Array.prototype.slice.call(args);