From 590eae18bf9fe25f614da9464436699ef7690238 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Wed, 24 Oct 2012 09:04:57 -0700 Subject: [PATCH] minor cosmetic changes --- lib/bunyan.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/bunyan.js b/lib/bunyan.js index dbc52ed..968f1ec 100644 --- a/lib/bunyan.js +++ b/lib/bunyan.js @@ -695,11 +695,12 @@ Logger.prototype._emit = function (rec) { }; } + /** - * build a log emitter function for level minLevel. - * + * Build a log emitter function for level minLevel. I.e. this is the + * creator of `log.info`, `log.error`, etc. */ -function logEmitter(minLevel) { +function mkLogEmitter(minLevel) { return function () { var fields = null, msgArgs = null; if (arguments.length === 0) { // `log.()` @@ -731,6 +732,7 @@ function logEmitter(minLevel) { } } + /** * The functions below log a record at a specific level. * @@ -740,22 +742,22 @@ function logEmitter(minLevel) { * log.( msg, ...) * log.( fields, msg, ...) * - * where is the lowercase version of the log level. Eg: + * where is the lowercase version of the log level. E.g.: * - * log.info() + * log.info() * * @params fields {Object} Optional set of additional fields to log. * @params msg {String} Log message. This can be followed by additional * arguments that are handled like * [util.format](http://nodejs.org/docs/latest/api/all.html#util.format). */ +Logger.prototype.trace = mkLogEmitter(TRACE); +Logger.prototype.debug = mkLogEmitter(DEBUG); +Logger.prototype.info = mkLogEmitter(INFO); +Logger.prototype.warn = mkLogEmitter(WARN); +Logger.prototype.error = mkLogEmitter(ERROR); +Logger.prototype.fatal = mkLogEmitter(FATAL); -Logger.prototype.trace = logEmitter(TRACE); -Logger.prototype.debug = logEmitter(DEBUG); -Logger.prototype.info = logEmitter(INFO); -Logger.prototype.warn = logEmitter(WARN); -Logger.prototype.error = logEmitter(ERROR); -Logger.prototype.fatal = logEmitter(FATAL); //---- Standard serializers