From 0f0270742918755149ff78ee45f65485d918710e Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Wed, 22 Feb 2012 10:53:12 -0800 Subject: [PATCH] put 'level' field earlier in record --- CHANGES.md | 5 ++++- lib/bunyan.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 49f4ee7..f56bbf4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,10 @@ ## bunyan 0.6.5 (not yet released) -(nothing yet) +- Add 'level' field to log record before custom fields for that record. This just + means that the raw record JSON will show the 'level' field earlier, which is a bit + nicer for raw reading. + ## bunyan 0.6.4 diff --git a/lib/bunyan.js b/lib/bunyan.js index ebba6f4..717c17d 100644 --- a/lib/bunyan.js +++ b/lib/bunyan.js @@ -600,6 +600,7 @@ Logger.prototype._mkRecord = function (fields, level, msgArgs) { */ Logger.prototype._emit = function (rec) { var obj = objCopy(rec[0]); + var level = obj.level = rec[2]; var recFields = rec[1]; if (recFields) { if (this.serializers) { @@ -609,7 +610,6 @@ Logger.prototype._emit = function (rec) { obj[k] = recFields[k]; }); } - var level = obj.level = rec[2]; xxx("Record:", rec) obj.msg = format.apply(this, rec[3]); if (!obj.time) {