Comparing version 0.1.0 to 0.2.0
12
index.js
@@ -33,2 +33,3 @@ /** | ||
}); | ||
this._logger = new (winston.Logger)({transports: [consoleTransport]}); | ||
@@ -39,2 +40,11 @@ this._logger.cli(); | ||
/** | ||
* Read the instance's level from our internal logger. | ||
* | ||
* @return {string} | ||
*/ | ||
get level() { | ||
return this._logger.transports.console.level; | ||
} | ||
/** | ||
* Sets a new logger level on the internal winston logger. The level dictates | ||
@@ -46,3 +56,3 @@ * the minimum level severity that you will log to the console. | ||
*/ | ||
setLevel(newLevel) { | ||
set level(newLevel) { | ||
this._logger.transports.console.level = newLevel; | ||
@@ -49,0 +59,0 @@ } |
{ | ||
"name": "plylog", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "A logger for the Polymer CLI toolchain", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -51,10 +51,17 @@ /** | ||
test('changes its internal logger\'s level when setLevel() is called', () => { | ||
test('changes its internal logger\'s level when level property is changed', () => { | ||
let logger = logging.getLogger('TEST_LOGGER'); | ||
logger.setLevel('info'); | ||
logger.level = 'info'; | ||
assert.equal(logger._logger.transports.console.level, 'info'); | ||
logger.setLevel('debug'); | ||
logger.level = 'debug'; | ||
assert.equal(logger._logger.transports.console.level, 'debug'); | ||
}); | ||
test('reads its internal logger\'s level when the level property is read', () => { | ||
let logger = logging.getLogger('TEST_LOGGER'); | ||
logger.level = 'silly'; | ||
assert.equal(logger._logger.transports.console.level, 'silly'); | ||
assert.equal(logger.level, 'silly'); | ||
}); | ||
test('loggers properly pass arguments to their internal logger\'s log methods when called', () => { | ||
@@ -61,0 +68,0 @@ let logger = logging.getLogger('TEST_LOGGER'); |
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
8223
195