issue #131 Allow log.info(<number>)
and, most importantly, don't crash on that.
This commit is contained in:
parent
a689ca171e
commit
36f7e51a65
4 changed files with 6 additions and 3 deletions
|
@ -8,6 +8,8 @@ Known issues:
|
||||||
|
|
||||||
## bunyan 0.22.2 (not yet released)
|
## 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.
|
- Update 'mv' optional dep to latest.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ full API is:
|
||||||
// This is equivalent to `log.isInfoEnabled()` or
|
// This is equivalent to `log.isInfoEnabled()` or
|
||||||
// `log.isEnabledFor(INFO)` in log4j.
|
// `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('hi %s', bob, anotherVar); // Uses `util.format` for msg formatting.
|
||||||
|
|
||||||
log.info({foo: 'bar'}, 'hi');
|
log.info({foo: 'bar'}, 'hi');
|
||||||
|
|
|
@ -834,7 +834,7 @@ function emitRecord(rec, line, opts, stylize) {
|
||||||
var s = '';
|
var s = '';
|
||||||
if (res.header) {
|
if (res.header) {
|
||||||
s += res.header.trimRight();
|
s += res.header.trimRight();
|
||||||
} else if (typeof(res.headers) === 'string') {
|
} else if (typeof (res.headers) === 'string') {
|
||||||
s += res.headers.trimRight();
|
s += res.headers.trimRight();
|
||||||
} else if (res.headers) {
|
} else if (res.headers) {
|
||||||
if (res.statusCode) {
|
if (res.statusCode) {
|
||||||
|
|
|
@ -769,7 +769,8 @@ function mkLogEmitter(minLevel) {
|
||||||
} else {
|
} else {
|
||||||
msgArgs = Array.prototype.slice.call(args, 1);
|
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, ...)`
|
// `log.<level>(msg, ...)`
|
||||||
fields = null;
|
fields = null;
|
||||||
msgArgs = Array.prototype.slice.call(args);
|
msgArgs = Array.prototype.slice.call(args);
|
||||||
|
|
Loading…
Reference in a new issue