abstract-logger
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -46,2 +46,36 @@ (function() { | ||
(function() { | ||
var id, k, _results; | ||
_results = []; | ||
for (k in logLevels) { | ||
id = logLevels[k]; | ||
if (id < 0) { | ||
continue; | ||
} | ||
_results.push(AbstractLogger.prototype[k.toLowerCase()] = (function(aLevelId) { | ||
return function() { | ||
var aContext, arg2, args; | ||
aContext = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
arg2 = args[0]; | ||
if (isString(aContext) && isObject(arg2) && !isArray(arg2)) { | ||
arg2.level = aLevelId; | ||
if (this.inLevelContext(arg2)) { | ||
arg2.message = aContext; | ||
this.writeln(this.formatter.apply(this, args)); | ||
} | ||
} else if (isObject(aContext) && isString(aContext.message)) { | ||
aContext.level = aLevelId; | ||
if (this.inLevelContext(aContext)) { | ||
this.writeln(this.formatter.apply(this, arguments)); | ||
} | ||
} else if (this.inLevel(aLevelId)) { | ||
this.writeln.apply(this, arguments); | ||
} | ||
return this; | ||
}; | ||
})(id)); | ||
} | ||
return _results; | ||
})(); | ||
AbstractLogger.prototype.levels = logLevels; | ||
@@ -48,0 +82,0 @@ |
{ | ||
"name": "abstract-logger", | ||
"description": "It's an abstract logger.", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"homepage": "https://github.com/snowyu/abstract-logger.js", | ||
@@ -34,4 +34,4 @@ "repository": { | ||
"devDependencies": { | ||
"chai": "~3.2.0", | ||
"coffee-coverage": "^0.6.3", | ||
"chai": "~3.5.0", | ||
"coffee-coverage": "^1.0.1", | ||
"grunt": "~0.4.5", | ||
@@ -45,8 +45,8 @@ "grunt-contrib-clean": "~0.6.0", | ||
"grunt-release": "~0.9.0", | ||
"istanbul": "^0.3.18", | ||
"mocha": "~2.1.0", | ||
"pre-commit": "~1.1.1", | ||
"rimraf": "~2.2.8", | ||
"shasum": "1.0.0", | ||
"sinon": "~1.16.1", | ||
"istanbul": "^0.4.2", | ||
"mocha": "~2.4.5", | ||
"pre-commit": "~1.1.2", | ||
"rimraf": "~2.5.2", | ||
"shasum": "~1.0.2", | ||
"sinon": "~1.17.3", | ||
"sinon-chai": "~2.8.0" | ||
@@ -53,0 +53,0 @@ }, |
@@ -61,2 +61,4 @@ ## abstract-logger [](https://npmjs.org/package/abstract-logger) | ||
of the message. | ||
* `emergency/alert/critical/error/warning/notice/info/debug/trace(message[, context], args...)`: | ||
* log the specified level message. | ||
@@ -63,0 +65,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37313
224
97