Comparing version 0.2.0 to 0.3.0
89
index.js
@@ -36,2 +36,33 @@ /** | ||
this._logger.cli(); | ||
/** | ||
* Logs an ERROR message, if the log level allows it. These should be used | ||
* to give the user information about a serious error that occurred. Usually | ||
* used right before the process exits. | ||
*/ | ||
this.error = this._log.bind(this, 'error'); | ||
/** | ||
* Logs a WARN message, if the log level allows it. These should be used | ||
* to give the user information about some unexpected issue that was | ||
* encountered. Usually the process is able to continue, but the user should | ||
* still be concerned and hopefully investigate further. | ||
*/ | ||
this.warn = this._log.bind(this, 'warn'); | ||
/** | ||
* Logs an INFO message, if the log level allows it. These should be used | ||
* to give the user generatl information about the process, including progress | ||
* updates and status messages. | ||
*/ | ||
this.info = this._log.bind(this, 'info'); | ||
/** | ||
* Logs a DEBUG message, if the log level allows it. These should be used | ||
* to give the user useful information for debugging purposes. These will | ||
* generally only be displayed when the user is are troubleshooting an | ||
* issue. | ||
*/ | ||
this.debug = this._log.bind(this, 'debug'); | ||
} | ||
@@ -60,6 +91,5 @@ | ||
/** | ||
* Logs an ERROR message, if the log level allows it. These should be used | ||
* to give the user information about a serious error that occurred. Usually | ||
* used right before the process exits. | ||
* Logs a message of any level. Used internally by the public logging methods. | ||
* | ||
* @param {string} level The severity level of the log | ||
* @param {string} msg The message to log | ||
@@ -69,47 +99,6 @@ * @param {Object} [metadata] Optional metadata to log | ||
*/ | ||
error() { | ||
this._logger.error.apply(this._logger, arguments); | ||
_log() { | ||
this._logger.log.apply(this._logger, arguments); | ||
} | ||
/** | ||
* Logs a WARN message, if the log level allows it. These should be used | ||
* to give the user information about some unexpected issue that was | ||
* encountered. Usually the process is able to continue, but the user should | ||
* still be concerned and hopefully investigate further. | ||
* | ||
* @param {string} msg The message to log | ||
* @param {Object} [metadata] Optional metadata to log | ||
* @return {void} | ||
*/ | ||
warn() { | ||
this._logger.warn.apply(this._logger, arguments); | ||
} | ||
/** | ||
* Logs an INFO message, if the log level allows it. These should be used | ||
* to give the user generatl information about the process, including progress | ||
* updates and status messages. | ||
* | ||
* @param {string} msg The message to log | ||
* @param {Object} [metadata] Optional metadata to log | ||
* @return {void} | ||
*/ | ||
info() { | ||
this._logger.info.apply(this._logger, arguments); | ||
} | ||
/** | ||
* Logs a DEBUG message, if the log level allows it. These should be used | ||
* to give the user useful information for debugging purposes. These will | ||
* generally only be displayed when the user is are troubleshooting an | ||
* issue. | ||
* | ||
* @param {string} msg The message to log | ||
* @param {Object} [metadata] Optional metadata to log | ||
* @return {void} | ||
*/ | ||
debug() { | ||
this._logger.debug.apply(this._logger, arguments); | ||
} | ||
} | ||
@@ -119,3 +108,3 @@ | ||
configOptions: {}, | ||
level:'info', | ||
@@ -128,3 +117,3 @@ /** | ||
setVerbose: function() { | ||
this.configOptions.level = 'debug'; | ||
this.level = 'debug'; | ||
}, | ||
@@ -138,3 +127,3 @@ | ||
setQuiet: function() { | ||
this.configOptions.level = 'error'; | ||
this.level = 'error'; | ||
}, | ||
@@ -151,3 +140,3 @@ | ||
return new PolymerLogger({ | ||
level: this.configOptions.level, | ||
level: this.level, | ||
name: name, | ||
@@ -154,0 +143,0 @@ }); |
{ | ||
"name": "plylog", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "A logger for the Polymer CLI toolchain", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -33,2 +33,3 @@ /** | ||
logging.setVerbose(); | ||
assert.equal(logging.level, 'debug'); | ||
let logger = logging.getLogger('TEST_LOGGER'); | ||
@@ -44,2 +45,3 @@ assert.equal(logger._logger.transports.console.level, 'debug'); | ||
logging.setQuiet(); | ||
assert.equal(logging.level, 'error'); | ||
let logger = logging.getLogger('TEST_LOGGER'); | ||
@@ -46,0 +48,0 @@ assert.equal(logger._logger.transports.console.level, 'error'); |
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
8053
184