eazy-logger
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -7,3 +7,3 @@ /** | ||
var logger = require("./index").Logger({ | ||
prefix: "{blue:[}{magenta:easy-logger}{blue:] }" | ||
prefix: "{blue:[}{cyan:BS}{blue:] }" | ||
}).setLevelPrefixes(true).setLevel("debug"); | ||
@@ -27,3 +27,3 @@ | ||
*/ | ||
logger.log("error", "Use {green:built-in} %s", "String substitution"); | ||
logger.log("error", "Use {green:%s} %s", "String substitution", "is cool"); | ||
@@ -30,0 +30,0 @@ /** |
32
index.js
@@ -76,2 +76,20 @@ /** | ||
/** | ||
* Set an option once | ||
* @param path | ||
* @param value | ||
*/ | ||
Logger.prototype.setOnce = function (path, value) { | ||
if (typeof this.config[path] !== "undefined") { | ||
this._memo = { | ||
key: path, | ||
value: this.config[path] | ||
}; | ||
this.config[path] = value; | ||
} | ||
return this; | ||
}; | ||
/** | ||
* Add convenience method such as | ||
@@ -92,2 +110,3 @@ * logger.warn("msg") | ||
this.log.apply(this, args); | ||
return this; | ||
}.bind(this, item); | ||
@@ -199,2 +218,4 @@ } | ||
this.resetTemps(); | ||
return this; | ||
@@ -204,2 +225,13 @@ }; | ||
/** | ||
* @param args | ||
* @param msg | ||
* @param level | ||
* @param unprefixed | ||
*/ | ||
Logger.prototype.resetTemps = function () { | ||
if (typeof this._memo !== "undefined") { | ||
this.config[this._memo.key] = this._memo.value; | ||
} | ||
}; | ||
/** | ||
* Get a clone of the logger | ||
@@ -206,0 +238,0 @@ * @param opts |
{ | ||
"name": "eazy-logger", | ||
"description": "Simple cli logger", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"homepage": "https://github.com/shakyshane/easy-logger", | ||
@@ -6,0 +6,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7660
242