Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appium-logger

Package Overview
Dependencies
Maintainers
6
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appium-logger - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

build/test/logger-test-specs.js

72

build/lib/logger.js
'use strict';
var _core = require('babel-runtime/core-js')['default'];
var _Object$defineProperty = require('babel-runtime/core-js/object/define-property')['default'];
var _interopRequireWildcard = require('babel-runtime/helpers/interop-require-wildcard')['default'];
var _getIterator = require('babel-runtime/core-js/get-iterator')['default'];
_core.Object.defineProperty(exports, '__esModule', {
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
_Object$defineProperty(exports, '__esModule', {
value: true
});
exports.patchLogger = patchLogger;
exports.getLogger = getLogger;

@@ -15,5 +18,5 @@

var _npmlog2 = _interopRequireWildcard(_npmlog);
var _npmlog2 = _interopRequireDefault(_npmlog);
var npmLevels = ['silly', 'verbose', 'info', 'http', 'warn', 'error'];
var npmLevels = ['silly', 'verbose', 'debug', 'info', 'http', 'warn', 'error'];
var mockLog = {};

@@ -25,3 +28,3 @@ var _iteratorNormalCompletion = true;

try {
for (var _iterator = _core.getIterator(npmLevels), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
for (var _iterator = _getIterator(npmLevels), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var l = _step.value;

@@ -46,11 +49,62 @@

function getLogger() {
function patchLogger(logger) {
if (!logger.debug) {
logger.addLevel('debug', 1000, { fg: 'blue', bg: 'black' }, 'dbg');
}
}
function _getLogger() {
var testingMode = parseInt(process.env._TESTING, 10) === 1;
var forceLogMode = parseInt(process.env._FORCE_LOGS, 10) === 1;
return testingMode && !forceLogMode ? mockLog : global._global_npmlog || _npmlog2['default'];
var logger = testingMode && !forceLogMode ? mockLog : global._global_npmlog || _npmlog2['default'];
patchLogger(logger);
return logger;
}
function getLogger() {
var prefix = arguments[0] === undefined ? null : arguments[0];
var logger = _getLogger();
var wrappedLogger = {};
_Object$defineProperty(wrappedLogger, 'level', {
get: function get() {
return logger.level;
},
set: function set(newValue) {
logger.level = newValue;
},
enumerable: true,
configurable: true
});
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = _getIterator(npmLevels), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var k = _step2.value;
wrappedLogger[k] = logger[k].bind(logger, prefix);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2['return']) {
_iterator2['return']();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
return wrappedLogger;
}
var log = getLogger();
exports['default'] = log;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9sb2dnZXIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztRQVFnQixTQUFTLEdBQVQsU0FBUzs7c0JBUk4sUUFBUTs7OztBQUUzQixJQUFNLFNBQVMsR0FBRyxDQUFDLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxFQUFFLE1BQU0sRUFBRSxNQUFNLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFDeEUsSUFBSSxPQUFPLEdBQUcsRUFBRSxDQUFDOzs7Ozs7QUFDakIseUNBQWMsU0FBUyw0R0FBRTtRQUFoQixDQUFDOztBQUNSLFdBQU8sQ0FBQyxDQUFDLENBQUMsR0FBRyxZQUFNLEVBQUUsQ0FBQztHQUN2Qjs7Ozs7Ozs7Ozs7Ozs7OztBQUVNLFNBQVMsU0FBUyxHQUFJO0FBQzNCLE1BQU0sV0FBVyxHQUFHLFFBQVEsQ0FBQyxPQUFPLENB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CB7XG4gICAgZ2V0OiBmdW5jdGlvbiAoKSB7IHJldHVybiBsb2dnZXIubGV2ZWw7IH0sXG4gICAgc2V0OiBmdW5jdGlvbiAobmV3VmFsdWUpIHsgbG9nZ2VyLmxldmVsID0gbmV3VmFsdWU7IH0sXG4gICAgZW51bWVyYWJsZTogdHJ1ZSxcbiAgICBjb25maWd1cmFibGU6IHRydWVcbiAgfSk7XG4gIGZvcihsZXQgayBvZiBucG1MZXZlbHMpIHtcbiAgICB3cmFwcGVkTG9nZ2VyW2tdID0gbG9nZ2VyW2tdLmJpbmQobG9nZ2VyLCBwcmVmaXgpO1xuICB9XG4gIHJldHVybiB3cmFwcGVkTG9nZ2VyO1xufVxuXG5jb25zdCBsb2cgPSBnZXRMb2dnZXIoKTtcblxuZXhwb3J0IGRlZmF1bHQgbG9nO1xuIl19

42

build/test/helpers.js
'use strict';
var _core = require('babel-runtime/core-js')['default'];
var _Object$defineProperty = require('babel-runtime/core-js/object/define-property')['default'];
var _interopRequireWildcard = require('babel-runtime/helpers/interop-require-wildcard')['default'];
var _getIterator = require('babel-runtime/core-js/get-iterator')['default'];
_core.Object.defineProperty(exports, '__esModule', {
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
_Object$defineProperty(exports, '__esModule', {
value: true

@@ -13,13 +15,13 @@ });

var _chai2 = _interopRequireWildcard(_chai);
var _chai2 = _interopRequireDefault(_chai);
var _sinon = require('sinon');
var _sinon2 = _interopRequireWildcard(_sinon);
var _sinon2 = _interopRequireDefault(_sinon);
var _import = require('lodash');
var _lodash = require('lodash');
var _import2 = _interopRequireWildcard(_import);
var _lodash2 = _interopRequireDefault(_lodash);
var _getLogger = require('../lib/logger');
var _libLogger = require('../lib/logger');

@@ -29,10 +31,12 @@ _chai2['default'].should();

function setupWriters() {
return { stdout: _sinon2['default'].spy(process.stdout, 'write'),
stderr: _sinon2['default'].spy(process.stderr, 'write') };
return { 'stdout': _sinon2['default'].spy(process.stdout, 'write'),
'stderr': _sinon2['default'].spy(process.stderr, 'write') };
}
function getDynamicLogger(testingMode, forceLogs) {
var prefix = arguments[2] === undefined ? null : arguments[2];
process.env._TESTING = testingMode ? '1' : '0';
process.env._FORCE_LOGS = forceLogs ? '1' : '0';
return _getLogger.getLogger();
return (0, _libLogger.getLogger)(prefix);
}

@@ -46,3 +50,3 @@

try {
for (var _iterator = _core.getIterator(_import2['default'].values(writers)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
for (var _iterator = _getIterator(_lodash2['default'].values(writers)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var w = _step.value;

@@ -70,2 +74,6 @@

var someoneHadOutput = false;
var matchOutput = _sinon2['default'].match(function (value) {
return value && value.indexOf(output) >= 0;
}, 'matchOutput');
var _iteratorNormalCompletion2 = true;

@@ -76,7 +84,7 @@ var _didIteratorError2 = false;

try {
for (var _iterator2 = _core.getIterator(_import2['default'].values(writers)), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
for (var _iterator2 = _getIterator(_lodash2['default'].values(writers)), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var w = _step2.value;
if (w.calledWith) {
someoneHadOutput = w.calledWith(output);
someoneHadOutput = w.calledWithMatch(matchOutput);
if (someoneHadOutput) break;

@@ -111,6 +119,6 @@ }

try {
for (var _iterator3 = _core.getIterator(_import2['default'].values(writers)), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
for (var _iterator3 = _getIterator(_lodash2['default'].values(writers)), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var w = _step3.value;
_import2['default'].flatten(w.args).should.not.contain(output);
_lodash2['default'].flatten(w.args).should.not.contain(output);
}

@@ -138,2 +146,2 @@ } catch (err) {

exports.getD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cyh3cml0ZXJzKSkge1xuICAgIF8uZmxhdHRlbih3LmFyZ3MpLnNob3VsZC5ub3QuY29udGFpbihvdXRwdXQpO1xuICB9XG59XG5cbmV4cG9ydCB7IHNldHVwV3JpdGVycywgcmVzdG9yZVdyaXRlcnMsIGFzc2VydE91dHB1dENvbnRhaW5zLFxuICAgICAgICAgYXNzZXJ0T3V0cHV0RG9lc250Q29udGFpbiwgZ2V0RHluYW1pY0xvZ2dlciB9O1xuIl19
'use strict';
var _getDynamicLogger$restoreWriters$setupWriters$assertOutputContains = require('./helpers');
var _helpers = require('./helpers');

@@ -11,4 +11,4 @@ require('source-map-support').install();

before(function () {
writers = _getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.setupWriters();
log = _getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.getDynamicLogger(true, true);
writers = (0, _helpers.setupWriters)();
log = (0, _helpers.getDynamicLogger)(true, true);
log.level = 'silly';

@@ -18,3 +18,3 @@ });

after(function () {
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.restoreWriters(writers);
(0, _helpers.restoreWriters)(writers);
});

@@ -24,16 +24,17 @@

log.silly('silly');
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, 'silly');
(0, _helpers.assertOutputContains)(writers, 'silly');
log.verbose('verbose');
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, 'verbose');
(0, _helpers.assertOutputContains)(writers, 'verbose');
log.verbose('debug');
(0, _helpers.assertOutputContains)(writers, 'debug');
log.info('info');
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, 'info');
(0, _helpers.assertOutputContains)(writers, 'info');
log.http('http');
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, 'http');
(0, _helpers.assertOutputContains)(writers, 'http');
log.warn('warn');
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, 'warn');
log.error(null, 'error');
// npmlog adds a space before and a newline after error messages
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, ' error\n');
(0, _helpers.assertOutputContains)(writers, 'warn');
log.error('error');
(0, _helpers.assertOutputContains)(writers, 'error');
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvbG9nZ2VyLWZvcmNlLXNwZWNzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O2lGQUdxQyxXQUFXOztBQUhoRCxPQUFPLENBQUMsb0JBQW9CLENBQUMsQ0FBQyxPQUFPLEVBQUUsQ0FBQzs7QUFLeEMsUUFBUSxDQUFDLHVCQUF1QixFQUFFLFlBQU07QUFDdEMsTUFBSSxPQUFPLFlBQUE7TUFBRSxHQUFHLFlBQUEsQ0FBQztBQUNqQixRQUFNLENBQUMsWUFBTTtBQUNYLFdBQU8sR0FBRyxtRUFONkIsWUFBWSxFQU0zQixDQUFDO0FBQ3pCLE9BQUcsR0FBRyxtRUFQRCxnQkFBZ0IsQ0FPRSxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUM7QUFDbkMsT0FBRyxDQUFDLEtBQUssR0FBRyxPQUFPLENBQUM7R0FDckIsQ0FBQyxDQUFDOztBQUVILE9BQUssQ0FBQyxZQUFNO0FBQ1YsdUVBWnVCLGNBQWMsQ0FZdEIsT0FBTyxDQUFDLENBQUM7R0FDekIsQ0FBQyxDQUFDOztBQUVILElBQUUsQ0FBQyxtREFBbUQsRUFBRSxZQUFNO0FBQzVELE9BQUcsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUM7QUFDbkIsdUVBaEJLLG9CQUFvQixDQWdCSixPQUFPLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFDdkMsT0FBRyxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQztBQUN2Qix1RUFsQkssb0JBQW9CLENBa0JKLE9BQU8sRUFBRSxTQUFTLENBQUMsQ0FB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3NlcnRPdXRwdXRDb250YWlucyh3cml0ZXJzLCAnc2lsbHknKTtcbiAgICBsb2cudmVyYm9zZSgndmVyYm9zZScpO1xuICAgIGFzc2VydE91dHB1dENvbnRhaW5zKHdyaXRlcnMsICd2ZXJib3NlJyk7XG4gICAgbG9nLnZlcmJvc2UoJ2RlYnVnJyk7XG4gICAgYXNzZXJ0T3V0cHV0Q29udGFpbnMod3JpdGVycywgJ2RlYnVnJyk7XG4gICAgbG9nLmluZm8oJ2luZm8nKTtcbiAgICBhc3NlcnRPdXRwdXRDb250YWlucyh3cml0ZXJzLCAnaW5mbycpO1xuICAgIGxvZy5odHRwKCdodHRwJyk7XG4gICAgYXNzZXJ0T3V0cHV0Q29udGFpbnMod3JpdGVycywgJ2h0dHAnKTtcbiAgICBsb2cud2Fybignd2FybicpO1xuICAgIGFzc2VydE91dHB1dENvbnRhaW5zKHdyaXRlcnMsICd3YXJuJyk7XG4gICAgbG9nLmVycm9yKCdlcnJvcicpO1xuICAgIGFzc2VydE91dHB1dENvbnRhaW5zKHdyaXRlcnMsICdlcnJvcicpO1xuICB9KTtcbn0pO1xuIl19
'use strict';
var _getDynamicLogger$restoreWriters$setupWriters$assertOutputContains = require('./helpers');
var _helpers = require('./helpers');
require('source-map-support').install();
describe('logger', function () {
describe('normal logger', function () {
var writers = undefined,
log = undefined;
before(function () {
writers = _getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.setupWriters();
log = _getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.getDynamicLogger(false, false);
writers = (0, _helpers.setupWriters)();
log = (0, _helpers.getDynamicLogger)(false, false);
log.level = 'silly';

@@ -17,3 +17,3 @@ });

after(function () {
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.restoreWriters(writers);
(0, _helpers.restoreWriters)(writers);
});

@@ -23,16 +23,55 @@

log.silly('silly');
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, 'silly');
(0, _helpers.assertOutputContains)(writers, 'silly');
log.verbose('verbose');
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, 'verbose');
(0, _helpers.assertOutputContains)(writers, 'verbose');
log.verbose('debug');
(0, _helpers.assertOutputContains)(writers, 'debug');
log.info('info');
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, 'info');
(0, _helpers.assertOutputContains)(writers, 'info');
log.http('http');
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, 'http');
(0, _helpers.assertOutputContains)(writers, 'http');
log.warn('warn');
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, 'warn');
log.error(null, 'error');
// npmlog adds a space before and a newline after error messages
_getDynamicLogger$restoreWriters$setupWriters$assertOutputContains.assertOutputContains(writers, ' error\n');
(0, _helpers.assertOutputContains)(writers, 'warn');
log.error('error');
(0, _helpers.assertOutputContains)(writers, 'error');
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvbG9nZ2VyLW5vcm1hbC1zcGVjcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztpRkFHcUMsV0FBVzs7QUFIaEQsT0FBTyxDQUFDLG9CQUFvQixDQUFDLENBQUMsT0FBTyxFQUFFLENBQUM7O0FBS3hDLFFBQVEsQ0FBQyxRQUFRLEVBQUUsWUFBTTtBQUN2QixNQUFJLE9BQU8sWUFBQTtNQUFFLEdBQUcsWUFBQSxDQUFDO0FBQ2pCLFFBQU0sQ0FBQyxZQUFNO0FBQ1gsV0FBTyxHQUFHLG1FQU42QixZQUFZLEVBTTNCLENBQUM7QUFDekIsT0FBRyxHQUFHLG1FQVBELGdCQUFnQixDQU9FLEtBQUssRUFBRSxLQUFLLENBQUMsQ0FBQztBQUNyQyxPQUFHLENBQUMsS0FBSyxHQUFHLE9BQU8sQ0FBQztHQUNyQixDQUFDLENBQUM7O0FBRUgsT0FBSyxDQUFDLFlB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BhIG5ld2xpbmUgYWZ0ZXIgZXJyb3IgbWVzc2FnZXNcbiAgICBhc3NlcnRPdXRwdXRDb250YWlucyh3cml0ZXJzLCAnIGVycm9yXFxuJyk7XG4gIH0pO1xufSk7XG4iXX0=
describe('normal logger with prefix', function () {
var writers = undefined,
log = undefined;
before(function () {
writers = (0, _helpers.setupWriters)();
log = (0, _helpers.getDynamicLogger)(false, false, 'myprefix');
log.level = 'silly';
});
after(function () {
(0, _helpers.restoreWriters)(writers);
});
it('should not rewrite log levels outside of testing', function () {
log.silly('silly');
(0, _helpers.assertOutputContains)(writers, 'silly');
(0, _helpers.assertOutputContains)(writers, 'myprefix');
log.verbose('verbose');
(0, _helpers.assertOutputContains)(writers, 'verbose');
(0, _helpers.assertOutputContains)(writers, 'myprefix');
log.verbose('debug');
(0, _helpers.assertOutputContains)(writers, 'debug');
(0, _helpers.assertOutputContains)(writers, 'myprefix');
log.info('info');
(0, _helpers.assertOutputContains)(writers, 'info');
(0, _helpers.assertOutputContains)(writers, 'myprefix');
log.http('http');
(0, _helpers.assertOutputContains)(writers, 'http');
(0, _helpers.assertOutputContains)(writers, 'myprefix');
log.warn('warn');
(0, _helpers.assertOutputContains)(writers, 'warn');
(0, _helpers.assertOutputContains)(writers, 'myprefix');
log.error('error');
(0, _helpers.assertOutputContains)(writers, 'error');
(0, _helpers.assertOutputContains)(writers, 'myprefix');
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvbG9nZ2VyLW5vcm1hbC1zcGVjcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzt1QkFHcUMsV0FBVzs7QUFIaEQsT0FBTyxDQUFDLG9CQUFvQixDQUFDLENBQUMsT0FBTyxFQUFFLENBQUM7O0FBS3hDLFFBQVEsQ0FBQyxlQUFlLEVBQUUsWUFBTTtBQUM5QixNQUFJLE9BQU8sWUFBQTtNQUFFLEdBQUcsWUFBQSxDQUFDO0FBQ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RlYnVnJyk7XG4gICAgYXNzZXJ0T3V0cHV0Q29udGFpbnMod3JpdGVycywgJ215cHJlZml4Jyk7XG4gICAgbG9nLmluZm8oJ2luZm8nKTtcbiAgICBhc3NlcnRPdXRwdXRDb250YWlucyh3cml0ZXJzLCAnaW5mbycpO1xuICAgIGFzc2VydE91dHB1dENvbnRhaW5zKHdyaXRlcnMsICdteXByZWZpeCcpO1xuICAgIGxvZy5odHRwKCdodHRwJyk7XG4gICAgYXNzZXJ0T3V0cHV0Q29udGFpbnMod3JpdGVycywgJ2h0dHAnKTtcbiAgICBhc3NlcnRPdXRwdXRDb250YWlucyh3cml0ZXJzLCAnbXlwcmVmaXgnKTtcbiAgICBsb2cud2Fybignd2FybicpO1xuICAgIGFzc2VydE91dHB1dENvbnRhaW5zKHdyaXRlcnMsICd3YXJuJyk7XG4gICAgYXNzZXJ0T3V0cHV0Q29udGFpbnMod3JpdGVycywgJ215cHJlZml4Jyk7XG4gICAgbG9nLmVycm9yKCdlcnJvcicpO1xuICAgIGFzc2VydE91dHB1dENvbnRhaW5zKHdyaXRlcnMsICdlcnJvcicpO1xuICAgIGFzc2VydE91dHB1dENvbnRhaW5zKHdyaXRlcnMsICdteXByZWZpeCcpO1xuICB9KTtcbn0pO1xuIl19
import npmlog from 'npmlog';
const npmLevels = ['silly', 'verbose', 'info', 'http', 'warn', 'error'];
const npmLevels = ['silly', 'verbose', 'debug', 'info', 'http', 'warn', 'error'];
let mockLog = {};

@@ -9,11 +9,34 @@ for (let l of npmLevels) {

export function getLogger () {
export function patchLogger(logger) {
if (!logger.debug) {
logger.addLevel('debug', 1000, { fg: 'blue', bg: 'black' }, 'dbg');
}
}
function _getLogger () {
const testingMode = parseInt(process.env._TESTING, 10) === 1;
const forceLogMode = parseInt(process.env._FORCE_LOGS, 10) === 1;
return (testingMode && !forceLogMode) ? mockLog :
(global._global_npmlog || npmlog);
let logger = (testingMode && !forceLogMode) ? mockLog :
(global._global_npmlog || npmlog);
patchLogger(logger);
return logger;
}
export function getLogger(prefix = null) {
let logger = _getLogger();
let wrappedLogger = {};
Object.defineProperty(wrappedLogger, 'level', {
get: function () { return logger.level; },
set: function (newValue) { logger.level = newValue; },
enumerable: true,
configurable: true
});
for(let k of npmLevels) {
wrappedLogger[k] = logger[k].bind(logger, prefix);
}
return wrappedLogger;
}
const log = getLogger();
export default log;

@@ -7,3 +7,3 @@ {

],
"version": "1.0.1",
"version": "1.1.0",
"author": "appium",

@@ -10,0 +10,0 @@ "license": "Apache License 2.0",

@@ -10,5 +10,5 @@ appium-logger

```js
import { default as log } from 'appium-logger';
import { getLogger } from 'appium-logger';
let log = getLogger('mymodule');
log.info("hi!");
```

@@ -12,6 +12,6 @@ import chai from 'chai';

function getDynamicLogger (testingMode, forceLogs) {
function getDynamicLogger (testingMode, forceLogs, prefix=null) {
process.env._TESTING = testingMode ? '1' : '0';
process.env._FORCE_LOGS = forceLogs ? '1' : '0';
return getLogger();
return getLogger(prefix);
}

@@ -27,5 +27,9 @@

let someoneHadOutput = false;
let matchOutput = sinon.match(function (value) {
return value && value.indexOf(output) >= 0;
}, "matchOutput");
for (let w of _.values(writers)) {
if (w.calledWith) {
someoneHadOutput = w.calledWith(output);
someoneHadOutput = w.calledWithMatch(matchOutput);
if (someoneHadOutput) break;

@@ -32,0 +36,0 @@ }

@@ -23,2 +23,4 @@ // transpile:mocha

assertOutputContains(writers, 'verbose');
log.verbose('debug');
assertOutputContains(writers, 'debug');
log.info('info');

@@ -30,6 +32,5 @@ assertOutputContains(writers, 'info');

assertOutputContains(writers, 'warn');
log.error(null, 'error');
// npmlog adds a space before and a newline after error messages
assertOutputContains(writers, ' error\n');
log.error('error');
assertOutputContains(writers, 'error');
});
});

@@ -6,3 +6,3 @@ // transpile:mocha

describe('logger', () => {
describe('normal logger', () => {
let writers, log;

@@ -24,2 +24,4 @@ before(() => {

assertOutputContains(writers, 'verbose');
log.verbose('debug');
assertOutputContains(writers, 'debug');
log.info('info');

@@ -31,6 +33,42 @@ assertOutputContains(writers, 'info');

assertOutputContains(writers, 'warn');
log.error(null, 'error');
// npmlog adds a space before and a newline after error messages
assertOutputContains(writers, ' error\n');
log.error('error');
assertOutputContains(writers, 'error');
});
});
describe('normal logger with prefix', () => {
let writers, log;
before(() => {
writers = setupWriters();
log = getDynamicLogger(false, false, 'myprefix');
log.level = 'silly';
});
after(() => {
restoreWriters(writers);
});
it('should not rewrite log levels outside of testing', () => {
log.silly('silly');
assertOutputContains(writers, 'silly');
assertOutputContains(writers, 'myprefix');
log.verbose('verbose');
assertOutputContains(writers, 'verbose');
assertOutputContains(writers, 'myprefix');
log.verbose('debug');
assertOutputContains(writers, 'debug');
assertOutputContains(writers, 'myprefix');
log.info('info');
assertOutputContains(writers, 'info');
assertOutputContains(writers, 'myprefix');
log.http('http');
assertOutputContains(writers, 'http');
assertOutputContains(writers, 'myprefix');
log.warn('warn');
assertOutputContains(writers, 'warn');
assertOutputContains(writers, 'myprefix');
log.error('error');
assertOutputContains(writers, 'error');
assertOutputContains(writers, 'myprefix');
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc