appium-logger
Advanced tools
Comparing version 1.1.7 to 2.0.0
@@ -5,4 +5,2 @@ 'use strict'; | ||
var _Object$defineProperty = require('babel-runtime/core-js/object/define-property')['default']; | ||
var _getIterator = require('babel-runtime/core-js/get-iterator')['default']; | ||
@@ -12,9 +10,6 @@ | ||
_Object$defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
exports.patchLogger = patchLogger; | ||
exports.getLogger = getLogger; | ||
var _npmlog = require('npmlog'); | ||
@@ -24,3 +19,6 @@ | ||
var npmLevels = ['silly', 'verbose', 'debug', 'info', 'http', 'warn', 'error']; | ||
// levels that are available from `npmlog` | ||
var NPM_LEVELS = ['silly', 'verbose', 'debug', 'info', 'http', 'warn', 'error']; | ||
// mock log object used in testing mode | ||
var mockLog = {}; | ||
@@ -32,6 +30,6 @@ var _iteratorNormalCompletion = true; | ||
try { | ||
for (var _iterator = _getIterator(npmLevels), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var l = _step.value; | ||
for (var _iterator = _getIterator(NPM_LEVELS), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var level = _step.value; | ||
mockLog[l] = function () {}; | ||
mockLog[level] = function () {}; | ||
} | ||
@@ -60,6 +58,17 @@ } catch (err) { | ||
function _getLogger() { | ||
// check if the user set the `_TESTING` or `_FORCE_LOGS` flag | ||
var testingMode = parseInt(process.env._TESTING, 10) === 1; | ||
var forceLogMode = parseInt(process.env._FORCE_LOGS, 10) === 1; | ||
// if is possible that there is a logger instance that is already around, | ||
// in which case we want t o use that | ||
var usingGlobalLog = !!global._global_npmlog; | ||
var logger = testingMode && !forceLogMode ? mockLog : global._global_npmlog || _npmlog2['default']; | ||
var logger = undefined; | ||
if (testingMode && !forceLogMode) { | ||
// in testing mode, use a mock logger object that we can query | ||
logger = mockLog; | ||
} else { | ||
// otherwise, either use the global, or a new `npmlog` object | ||
logger = global._global_npmlog || _npmlog2['default']; | ||
} | ||
patchLogger(logger); | ||
@@ -70,3 +79,3 @@ return [logger, usingGlobalLog]; | ||
function getLogger() { | ||
var prefix = arguments[0] === undefined ? null : arguments[0]; | ||
var prefix = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0]; | ||
@@ -80,6 +89,9 @@ var _getLogger2 = _getLogger(); | ||
// wrap the logger so that we can catch and modify any logging | ||
var wrappedLogger = { unwrap: function unwrap() { | ||
return logger; | ||
} }; | ||
_Object$defineProperty(wrappedLogger, 'level', { | ||
// allow access to the level of the underlying logger | ||
Object.defineProperty(wrappedLogger, 'level', { | ||
get: function get() { | ||
@@ -94,2 +106,3 @@ return logger.level; | ||
}); | ||
// add all the levels from `npmlog`, and map to the underlying logger | ||
var _iteratorNormalCompletion2 = true; | ||
@@ -100,7 +113,8 @@ var _didIteratorError2 = false; | ||
try { | ||
for (var _iterator2 = _getIterator(npmLevels), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var k = _step2.value; | ||
for (var _iterator2 = _getIterator(NPM_LEVELS), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var level = _step2.value; | ||
wrappedLogger[k] = logger[k].bind(logger, prefix); | ||
wrappedLogger[level] = logger[level].bind(logger, prefix); | ||
} | ||
// add method to log an error, and throw it, for convenience | ||
} catch (err) { | ||
@@ -122,5 +136,7 @@ _didIteratorError2 = true; | ||
wrappedLogger.errorAndThrow = function (err) { | ||
// make sure we have an `Error` object. Wrap if necessary | ||
if (!(err instanceof Error)) { | ||
err = new Error(err); | ||
} | ||
// log and throw | ||
this.error(err); | ||
@@ -135,9 +151,12 @@ throw err; | ||
} | ||
wrappedLogger.levels = npmLevels; | ||
wrappedLogger.levels = NPM_LEVELS; | ||
return wrappedLogger; | ||
} | ||
// export a default logger with no prefix | ||
var log = getLogger(); | ||
exports.patchLogger = patchLog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UncmUgbm90IHVzaW5nIGEgZ2xvYmFsIGxvZyBzcGVjaWZpZWQgZnJvbSBzb21lIHRvcC1sZXZlbCBwYWNrYWdlLFxuICAgIC8vIHNldCB0aGUgbG9nIGxldmVsIHRvIGEgZGVmYXVsdCBvZiB2ZXJib3NlLiBPdGhlcndpc2UsIGxldCB0aGUgdG9wLWxldmVsXG4gICAgLy8gcGFja2FnZSBzZXQgdGhlIGxvZyBsZXZlbFxuICAgIHdyYXBwZWRMb2dnZXIubGV2ZWwgPSAndmVyYm9zZSc7XG4gIH1cbiAgd3JhcHBlZExvZ2dlci5sZXZlbHMgPSBOUE1fTEVWRUxTO1xuICByZXR1cm4gd3JhcHBlZExvZ2dlcjtcbn1cblxuLy8gZXhwb3J0IGEgZGVmYXVsdCBsb2dnZXIgd2l0aCBubyBwcmVmaXhcbmNvbnN0IGxvZyA9IGdldExvZ2dlcigpO1xuXG5leHBvcnQgeyBwYXRjaExvZ2dlciwgZ2V0TG9nZ2VyIH07XG5leHBvcnQgZGVmYXVsdCBsb2c7XG4iXX0= |
'use strict'; | ||
var _Object$defineProperty = require('babel-runtime/core-js/object/define-property')['default']; | ||
var _getIterator = require('babel-runtime/core-js/get-iterator')['default']; | ||
@@ -9,3 +7,3 @@ | ||
_Object$defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
@@ -36,3 +34,3 @@ }); | ||
function getDynamicLogger(testingMode, forceLogs) { | ||
var prefix = arguments[2] === undefined ? null : arguments[2]; | ||
var prefix = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; | ||
@@ -71,4 +69,4 @@ process.env._TESTING = testingMode ? '1' : '0'; | ||
function assertOutputContains(writers, output) { | ||
var someoneHadOutput = false; | ||
function someoneHadOutput(writers, output) { | ||
var hadOutput = false; | ||
var matchOutput = _sinon2['default'].match(function (value) { | ||
@@ -84,7 +82,7 @@ return value && value.indexOf(output) >= 0; | ||
for (var _iterator2 = _getIterator(_lodash2['default'].values(writers)), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var w = _step2.value; | ||
var writer = _step2.value; | ||
if (w.calledWith) { | ||
someoneHadOutput = w.calledWithMatch(matchOutput); | ||
if (someoneHadOutput) break; | ||
if (writer.calledWith) { | ||
hadOutput = writer.calledWithMatch(matchOutput); | ||
if (hadOutput) break; | ||
} | ||
@@ -107,4 +105,8 @@ } | ||
if (!someoneHadOutput) { | ||
throw new Error('Expected someone to have been called with: \'' + output + '\''); | ||
return hadOutput; | ||
} | ||
function assertOutputContains(writers, output) { | ||
if (!someoneHadOutput(writers, output)) { | ||
throw new Error('Expected something to have been called with: \'' + output + '\''); | ||
} | ||
@@ -114,25 +116,4 @@ } | ||
function assertOutputDoesntContain(writers, output) { | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
try { | ||
for (var _iterator3 = _getIterator(_lodash2['default'].values(writers)), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var w = _step3.value; | ||
_lodash2['default'].flatten(w.args).should.not.contain(output); | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3['return']) { | ||
_iterator3['return'](); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
if (someoneHadOutput(writers, output)) { | ||
throw new Error('Expected nothing to have been called with: \'' + output + '\''); | ||
} | ||
@@ -146,2 +127,2 @@ } | ||
exports.getDynamicLogger = getDynamicLogger; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvaGVscGVycy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7b0JBQWlCLE1BQU07Ozs7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XG59XG5cbmZ1bmN0aW9uIGFzc2VydE91dHB1dENvbnRhaW5zICh3cml0ZXJzLCBvdXRwdXQpIHtcbiAgaWYgKCFzb21lb25lSGFkT3V0cHV0KHdyaXRlcnMsIG91dHB1dCkpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoYEV4cGVjdGVkIHNvbWV0aGluZyB0byBoYXZlIGJlZW4gY2FsbGVkIHdpdGg6ICcke291dHB1dH0nYCk7XG4gIH1cbn1cblxuZnVuY3Rpb24gYXNzZXJ0T3V0cHV0RG9lc250Q29udGFpbiAod3JpdGVycywgb3V0cHV0KSB7XG4gIGlmIChzb21lb25lSGFkT3V0cHV0KHdyaXRlcnMsIG91dHB1dCkpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoYEV4cGVjdGVkIG5vdGhpbmcgdG8gaGF2ZSBiZWVuIGNhbGxlZCB3aXRoOiAnJHtvdXRwdXR9J2ApO1xuICB9XG59XG5cbmV4cG9ydCB7IHNldHVwV3JpdGVycywgcmVzdG9yZVdyaXRlcnMsIGFzc2VydE91dHB1dENvbnRhaW5zLFxuICAgICAgICAgYXNzZXJ0T3V0cHV0RG9lc250Q29udGFpbiwgZ2V0RHluYW1pY0xvZ2dlciB9O1xuIl19 |
@@ -42,2 +42,2 @@ require('source-map-support').install(); | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvbG9nZ2VyLWZvcmNlLXNwZWNzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7dUJBR3FDLFdBQVc7O0FBRWhELFFBQVEsQ0FBQyx1QkFBdUIsRUFBRSxZQUFNO0FBQ3RDLE1BQUksT0FBTyxZQUFBO01BQUUsR0FBRyxZQUFBLENBQUM7QUFDakIsUUFBTSxDQUFDLFlBQU07QUFDWCxXQUFPLEdBQUcsYUFONkIsWUFBWSxHQU0zQixDQUFDO0FBQ3pCLE9BQUcsR0FBRyxhQVBELG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W5zKHdyaXRlcnMsICdzaWxseScpO1xuICAgIGxvZy52ZXJib3NlKCd2ZXJib3NlJyk7XG4gICAgYXNzZXJ0T3V0cHV0Q29udGFpbnMod3JpdGVycywgJ3ZlcmJvc2UnKTtcbiAgICBsb2cudmVyYm9zZSgnZGVidWcnKTtcbiAgICBhc3NlcnRPdXRwdXRDb250YWlucyh3cml0ZXJzLCAnZGVidWcnKTtcbiAgICBsb2cuaW5mbygnaW5mbycpO1xuICAgIGFzc2VydE91dHB1dENvbnRhaW5zKHdyaXRlcnMsICdpbmZvJyk7XG4gICAgbG9nLmh0dHAoJ2h0dHAnKTtcbiAgICBhc3NlcnRPdXRwdXRDb250YWlucyh3cml0ZXJzLCAnaHR0cCcpO1xuICAgIGxvZy53YXJuKCd3YXJuJyk7XG4gICAgYXNzZXJ0T3V0cHV0Q29udGFpbnMod3JpdGVycywgJ3dhcm4nKTtcbiAgICBsb2cuZXJyb3IoJ2Vycm9yJyk7XG4gICAgYXNzZXJ0T3V0cHV0Q29udGFpbnMod3JpdGVycywgJ2Vycm9yJyk7XG4gICAgKCgpID0+IHsgbG9nLmVycm9yQW5kVGhyb3coJ21zZycpOyB9KS5zaG91bGQudGhyb3coJ21zZycpO1xuICAgIGFzc2VydE91dHB1dENvbnRhaW5zKHdyaXRlcnMsICdlcnJvcicpO1xuICAgIGFzc2VydE91dHB1dENvbnRhaW5zKHdyaXRlcnMsICdtc2cnKTtcbiAgfSk7XG59KTtcbiJdfQ== |
@@ -10,3 +10,3 @@ require('source-map-support').install(); | ||
log = undefined; | ||
before(function () { | ||
beforeEach(function () { | ||
writers = (0, _helpers.setupWriters)(); | ||
@@ -17,3 +17,3 @@ log = (0, _helpers.getDynamicLogger)(false, false); | ||
after(function () { | ||
afterEach(function () { | ||
(0, _helpers.restoreWriters)(writers); | ||
@@ -48,2 +48,10 @@ }); | ||
}); | ||
it('should get and set log levels', function () { | ||
log.level = 'warn'; | ||
log.level.should.equal('warn'); | ||
log.info('information'); | ||
log.warn('warning'); | ||
(0, _helpers.assertOutputDoesntContain)(writers, 'information'); | ||
(0, _helpers.assertOutputContains)(writers, 'warning'); | ||
}); | ||
}); | ||
@@ -95,2 +103,2 @@ | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvbG9nZ2VyLW5vcm1hbC1zcGVjcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O3VCQUdxQyxXQUFXOztBQUVoRCxRQUFRLENBQUMsZUFBZSxFQUFFLFlBQU07QUFDOUIsTUFBSSxPQUFPLFlBQUE7TUFBRSxHQUFHLFlBQUEsQ0FBQztBQUNqQixRQUFNLENBQUMsWUFBTTtBQUNYLFdBQU8sR0FBRyxhQU42QixZQUFZLEdBTTNCLENBQUM7QUFDekIsT0FBRyxHQUFHLGFBUEQsZ0JBQWdCLEVBT0UsS0FBSyxFQUFFLEtBQUssQ0FBQyxDQUFDO0FBQ3JDLE9BQUcsQ0FBQyxLQUFLLEdBQUcsT0FBTyxDQUFDO0dBQ3JCLENBQUMsQ0FBQzs7QUFFSCxPQUFLLENBQUMsWUFBTTtBQUNWLGlCQVp1QixjQUFjLEVBWXRCLE9BQU8sQ0FBQyxDQUFDO0dBQ3pCLENBQUMsQ0FBQzs7QUFFSCxJQUFFLENBQUMsa0RBQWtELEVBQUUsWUFBTTtBQUMzRCxPQUFHLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0FBQ25CLGlCQWhCSyxvQkFBb0IsRUFnQkosT0FBTyxFQUFFLE9BQU8sQ0FBQyxDQUFDO0FBQ3ZDLE9BQUcsQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUM7QUFDdkIsaUJBbEJLLG9CQUFvQixFQWtCSixPQUFPLEVBQUUsU0FBUyxDQUFDLENBQUM7QUFDekMsT0FBRyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUNyQixpQkF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Skuc2hvdWxkLnRocm93KCdtc2cnKTtcbiAgICBhc3NlcnRPdXRwdXRDb250YWlucyh3cml0ZXJzLCAnZXJyb3InKTtcbiAgICBhc3NlcnRPdXRwdXRDb250YWlucyh3cml0ZXJzLCAnbXlwcmVmaXgnKTtcbiAgfSk7XG59KTtcbiJdfQ== |
@@ -25,4 +25,4 @@ require('source-map-support').install(); | ||
it('should unwrap', function () { | ||
log.unwrap.should.exists; | ||
log.unwrap().should.exists; | ||
log.unwrap.should.exist; | ||
log.unwrap().should.exist; | ||
}); | ||
@@ -44,2 +44,2 @@ | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvbG9nZ2VyLXRlc3Qtc3BlY3MuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozt1QkFHMEMsV0FBVzs7QUFFckQsUUFBUSxDQUFDLGFBQWEsRUFBRSxZQUFNO0FBQzVCLE1BQUksT0FBTyxZQUFBO01BQUUsR0FBRyxZQUFBLENBQUM7QUFDakIsUUFBTSxDQUFDLFlBQU07QUFDWCxXQUFPLEdBQUcsYUFONkIsWUFBWSxHQU0zQixDQUFDO0FBQ3pCLE9BQUcsR0FBRyxhQVBELGdCQUFnQixFQU9FLElBQUksQ0FBQyxDQUFDO0dBQzlCLENBQUMsQ0FBQzs7QUFFSCxPQUFLLENBQUMsWUFBTTtBQUNWLGlCQVh1QixjQUFjLEVBV3RCLE9BQU8sQ0FBQyxDQUFDO0dBQ3pCLENBQUMsQ0FBQzs7QUFFSCxJQUFFLENBQUMsd0JBQXdCLEVBQUUsWUFBTTtBQUNqQyxPQUFHLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUN2QyxPQUFHLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxLQ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ZXN0b3JlV3JpdGVycyh3cml0ZXJzKTtcbiAgfSk7XG5cbiAgaXQoJ3Nob3VsZCBjb250YWlucyBsZXZlbHMnLCAoKSA9PiB7XG4gICAgbG9nLmxldmVscy5zaG91bGQuaGF2ZS5sZW5ndGguYWJvdmUoMyk7XG4gICAgbG9nLmxldmVsc1syXS5zaG91bGQuZXF1YWwoJ2RlYnVnJyk7XG4gIH0pO1xuXG4gIGl0KCdzaG91bGQgdW53cmFwJywgKCkgPT4ge1xuICAgIGxvZy51bndyYXAuc2hvdWxkLmV4aXN0O1xuICAgIGxvZy51bndyYXAoKS5zaG91bGQuZXhpc3Q7XG4gIH0pO1xuXG4gIGl0KCdzaG91bGQgcmV3cml0ZSBucG1sb2cgbGV2ZWxzIGR1cmluZyB0ZXN0aW5nJywgKCkgPT4ge1xuICAgIGNvbnN0IHRleHQgPSAnaGknO1xuICAgIGxvZy5zaWxseSh0ZXh0KTtcbiAgICBsb2cudmVyYm9zZSh0ZXh0KTtcbiAgICBsb2cuaW5mbyh0ZXh0KTtcbiAgICBsb2cuaHR0cCh0ZXh0KTtcbiAgICBsb2cud2Fybih0ZXh0KTtcbiAgICBsb2cuZXJyb3IodGV4dCk7XG4gICAgKCgpID0+IHsgbG9nLmVycm9yQW5kVGhyb3codGV4dCk7IH0pLnNob3VsZC50aHJvdyh0ZXh0KTtcbiAgICBhc3NlcnRPdXRwdXREb2VzbnRDb250YWluKHdyaXRlcnMsIHRleHQpO1xuICB9KTtcbn0pO1xuIl19 |
import npmlog from 'npmlog'; | ||
const npmLevels = ['silly', 'verbose', 'debug', 'info', 'http', 'warn', 'error']; | ||
// levels that are available from `npmlog` | ||
const NPM_LEVELS = ['silly', 'verbose', 'debug', 'info', 'http', 'warn', 'error']; | ||
// mock log object used in testing mode | ||
let mockLog = {}; | ||
for (let l of npmLevels) { | ||
mockLog[l] = () => {}; | ||
for (let level of NPM_LEVELS) { | ||
mockLog[level] = () => {}; | ||
} | ||
export function patchLogger(logger) { | ||
function patchLogger (logger) { | ||
if (!logger.debug) { | ||
@@ -16,7 +20,17 @@ logger.addLevel('debug', 1000, { fg: 'blue', bg: 'black' }, 'dbug'); | ||
function _getLogger () { | ||
// check if the user set the `_TESTING` or `_FORCE_LOGS` flag | ||
const testingMode = parseInt(process.env._TESTING, 10) === 1; | ||
const forceLogMode = parseInt(process.env._FORCE_LOGS, 10) === 1; | ||
// if is possible that there is a logger instance that is already around, | ||
// in which case we want t o use that | ||
const usingGlobalLog = !!global._global_npmlog; | ||
let logger = (testingMode && !forceLogMode) ? mockLog : | ||
(global._global_npmlog || npmlog); | ||
let logger; | ||
if (testingMode && !forceLogMode) { | ||
// in testing mode, use a mock logger object that we can query | ||
logger = mockLog; | ||
} else { | ||
// otherwise, either use the global, or a new `npmlog` object | ||
logger = global._global_npmlog || npmlog; | ||
} | ||
patchLogger(logger); | ||
@@ -26,18 +40,26 @@ return [logger, usingGlobalLog]; | ||
export function getLogger(prefix = null) { | ||
function getLogger (prefix = null) { | ||
let [logger, usingGlobalLog] = _getLogger(); | ||
let wrappedLogger = {unwrap: () => { return logger;} }; | ||
// wrap the logger so that we can catch and modify any logging | ||
let wrappedLogger = {unwrap: () => logger}; | ||
// allow access to the level of the underlying logger | ||
Object.defineProperty(wrappedLogger, 'level', { | ||
get: function () { return logger.level; }, | ||
set: function (newValue) { logger.level = newValue; }, | ||
get: () => { return logger.level; }, | ||
set: (newValue) => { logger.level = newValue; }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
for(let k of npmLevels) { | ||
wrappedLogger[k] = logger[k].bind(logger, prefix); | ||
// add all the levels from `npmlog`, and map to the underlying logger | ||
for (let level of NPM_LEVELS) { | ||
wrappedLogger[level] = logger[level].bind(logger, prefix); | ||
} | ||
// add method to log an error, and throw it, for convenience | ||
wrappedLogger.errorAndThrow = function (err) { | ||
// make sure we have an `Error` object. Wrap if necessary | ||
if (!(err instanceof Error)) { | ||
err = new Error(err); | ||
} | ||
// log and throw | ||
this.error(err); | ||
@@ -52,8 +74,10 @@ throw err; | ||
} | ||
wrappedLogger.levels = npmLevels; | ||
wrappedLogger.levels = NPM_LEVELS; | ||
return wrappedLogger; | ||
} | ||
// export a default logger with no prefix | ||
const log = getLogger(); | ||
export { patchLogger, getLogger }; | ||
export default log; |
@@ -7,3 +7,3 @@ { | ||
], | ||
"version": "1.1.7", | ||
"version": "2.0.0", | ||
"author": "appium", | ||
@@ -27,5 +27,4 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"babel-runtime": "5.5.5", | ||
"babel-runtime": "=5.8.24", | ||
"npmlog": "^1.2.1", | ||
"q": "^1.4.1", | ||
"source-map-support": "^0.3.1" | ||
@@ -39,9 +38,8 @@ }, | ||
"devDependencies": { | ||
"appium-gulp-plugins": "^1.0.3", | ||
"chai": "^3.0.0", | ||
"gulp": "^3.8.11", | ||
"lodash": "^3.9.1", | ||
"mochawait": "^2.0.0", | ||
"sinon": "^1.14.1" | ||
"appium-gulp-plugins": "^1.3.11", | ||
"chai": "^3.2.0", | ||
"gulp": "^3.9.0", | ||
"lodash": "^3.10.1", | ||
"sinon": "^1.16.1" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
appium-logger | ||
=================== | ||
[![NPM version](http://img.shields.io/npm/v/appium-logger.svg)](https://npmjs.org/package/appium-logger) | ||
## appium-logger | ||
[![NPM version](http://img.shields.io/npm/v/appium-logger.svg)](https://npmjs.org/package/appium-logger) | ||
[![Downloads](http://img.shields.io/npm/dm/appium-logger.svg)](https://npmjs.org/package/appium-logger) | ||
@@ -11,9 +11,88 @@ [![Dependency Status](https://david-dm.org/appium/logger.svg)](https://david-dm.org/appium/logger) | ||
Basic logger defaulting to `npmlog` with special consideration for running | ||
Basic logger defaulting to [npmlog](https://github.com/npm/npmlog) with special consideration for running | ||
tests (doesn't output logs when run with `_TESTING=1` in the env). | ||
### Logging levels | ||
There are a number of levels, exposed as methods on the log object, at which logging can be made. The built-in ones correspond to those of [npmlog](https://github.com/npm/npmlog#loglevelprefix-message-), and are: | ||
`silly`, `verbose`, `info`, `http`, `warn`, and `error`. In addition there is a `debug` level. | ||
The default threshhold level is `verbose`. | ||
The logged output, by default, will be `level prefix message`. So | ||
```js | ||
import { getLogger } from 'appium-logger'; | ||
let log = getLogger('mymodule'); | ||
log.info("hi!"); | ||
log.warn('a warning');` | ||
``` | ||
Will produce | ||
```shell | ||
warn mymodule a warning | ||
``` | ||
### Environment variables | ||
There are two environment variable flags that affect the way `appium-logger` works. | ||
`_TESTING` | ||
- `_TESTING=1` stops output of logs when set to `1`. | ||
`_FORCE_LOGS` | ||
- This flag, when set to `1`, reverses the `_TESTING` | ||
### Usage | ||
`log.level` | ||
- get and set the threshhold level at which to display the logs. Any logs at or above this level will be displayed. The special level silent will prevent anything from being displayed ever. See [npmlog#level](https://github.com/npm/npmlog#loglevel). | ||
`log[level](message)` | ||
- logs to `level` | ||
```js | ||
import { getLogger } from 'appium-logger'; | ||
let log = getLogger('mymodule'); | ||
log.info('hi!'); | ||
// => info mymodule hi! | ||
``` | ||
`log.unwrap()` | ||
- retrieves the underlying [npmlog](https://github.com/npm/npmlog) object, in order to manage how logging is done at a low level (e.g., changing output streams, retrieving an array of messages, adding log levels, etc.). | ||
```js | ||
import { getLogger } from 'appium-logger'; | ||
let log = getLogger('mymodule'); | ||
log.info('hi!'); | ||
let npmlogger = log.unwrap(); | ||
// any `npmlog` methods | ||
let logs = npmlogger.record; | ||
// logs === [ { id: 0, level: 'info', prefix: 'mymodule', message: 'hi!', messageRaw: [ 'hi!' ] }] | ||
``` | ||
`log.errorAndThrow(error)` | ||
- logs the error passed in, at `error` level, and then throws the error. If the error passed in is not an instance of [Error](https://nodejs.org/api/errors.html#errors_class_error) (either directly, or a subclass of `Error`) it will be wrapped in a generic `Error` object. | ||
```js | ||
import { getLogger } from 'appium-logger'; | ||
let log = getLogger('mymodule'); | ||
// previously there would be two lines | ||
log.error('This is an error'); | ||
throw new Error('This is an error'); | ||
// now is compacted | ||
log.errorAndThrow('This is an error'); | ||
``` |
@@ -5,2 +5,4 @@ import chai from 'chai'; | ||
import { getLogger } from '../lib/logger'; | ||
chai.should(); | ||
@@ -25,16 +27,20 @@ | ||
function assertOutputContains (writers, output) { | ||
let someoneHadOutput = false; | ||
function someoneHadOutput (writers, output) { | ||
let hadOutput = false; | ||
let matchOutput = sinon.match(function (value) { | ||
return value && value.indexOf(output) >= 0; | ||
}, "matchOutput"); | ||
}, 'matchOutput'); | ||
for (let w of _.values(writers)) { | ||
if (w.calledWith) { | ||
someoneHadOutput = w.calledWithMatch(matchOutput); | ||
if (someoneHadOutput) break; | ||
for (let writer of _.values(writers)) { | ||
if (writer.calledWith) { | ||
hadOutput = writer.calledWithMatch(matchOutput); | ||
if (hadOutput) break; | ||
} | ||
} | ||
if (!someoneHadOutput) { | ||
throw new Error("Expected someone to have been called with: '" + output + "'"); | ||
return hadOutput; | ||
} | ||
function assertOutputContains (writers, output) { | ||
if (!someoneHadOutput(writers, output)) { | ||
throw new Error(`Expected something to have been called with: '${output}'`); | ||
} | ||
@@ -44,4 +50,4 @@ } | ||
function assertOutputDoesntContain (writers, output) { | ||
for (let w of _.values(writers)) { | ||
_.flatten(w.args).should.not.contain(output); | ||
if (someoneHadOutput(writers, output)) { | ||
throw new Error(`Expected nothing to have been called with: '${output}'`); | ||
} | ||
@@ -48,0 +54,0 @@ } |
// transpile:mocha | ||
import { getDynamicLogger, restoreWriters, setupWriters, | ||
assertOutputContains } from './helpers'; | ||
assertOutputContains, assertOutputDoesntContain } from './helpers'; | ||
describe('normal logger', () => { | ||
let writers, log; | ||
before(() => { | ||
beforeEach(() => { | ||
writers = setupWriters(); | ||
@@ -14,3 +14,3 @@ log = getDynamicLogger(false, false); | ||
after(() => { | ||
afterEach(() => { | ||
restoreWriters(writers); | ||
@@ -41,2 +41,10 @@ }); | ||
}); | ||
it('should get and set log levels', () => { | ||
log.level = 'warn'; | ||
log.level.should.equal('warn'); | ||
log.info('information'); | ||
log.warn('warning'); | ||
assertOutputDoesntContain(writers, 'information'); | ||
assertOutputContains(writers, 'warning'); | ||
}); | ||
}); | ||
@@ -43,0 +51,0 @@ |
@@ -23,4 +23,4 @@ // transpile:mocha | ||
it('should unwrap', () => { | ||
log.unwrap.should.exists; | ||
log.unwrap().should.exists; | ||
log.unwrap.should.exist; | ||
log.unwrap().should.exist; | ||
}); | ||
@@ -27,0 +27,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
144127
3
5
33
1459
98
2
- Removedq@^1.4.1
- Removedbabel-runtime@5.5.5(transitive)
- Removedcore-js@0.9.18(transitive)
- Removedq@1.5.1(transitive)
Updatedbabel-runtime@=5.8.24