Comparing version 0.0.0 to 0.0.1
CHANGELOG | ||
v0.0.0 - probe.gl is now open source. We'll keep it in 0.x version for a while until the API is stable. | ||
v0.0.1 | ||
- `Bench` and `Log` classes added. | ||
v0.0.0 | ||
- probe.gl is now open source. We'll keep it in 0.x version for a while until the API is stable. |
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
@@ -30,28 +28,30 @@ // | ||
/* global process */ | ||
import { window, isBrowser } from './utils/globals'; | ||
import console from 'global/console'; | ||
import window from 'global/window'; | ||
// Duck-type Node context | ||
export var IS_NODE = (typeof process === 'undefined' ? 'undefined' : _typeof(process)) !== undefined && process.toString() === '[object process]'; | ||
// Extract version from package.json (injected by webpack) | ||
/* global PROBE_VERSION */ | ||
export var VERSION = typeof PROBE_VERSION !== 'undefined' ? PROBE_VERSION : 'Node'; | ||
// Configure console | ||
function noop() {} | ||
// Console.debug is useful in chrome as it gives blue styling, but is not | ||
// available in node | ||
// Polyfill console | ||
// Console.debug is useful in chrome as it enables filtering and | ||
// (depending on Chrome version) distinctive styling, but is not available in node | ||
console.debug = console.debug || console.log; | ||
// Some instrumentation may override console methods, so preserve them here | ||
console.native = { | ||
debug: console.debug.bind(console), | ||
log: console.log.bind(console), | ||
warn: console.warn.bind(console), | ||
error: console.error.bind(console) | ||
}; | ||
// Groups, timeStamps, table are not available in node | ||
console.group = console.group || console.log; | ||
console.groupCollapsed = console.groupCollapsed || console.log; | ||
console.groupEnd = console.groupEnd || noop; | ||
export { console as logger }; | ||
console.timeStamp = console.timeStamp || noop; | ||
console.table = console.table || noop; | ||
// Set up high resolution timer | ||
var timestamp = void 0; | ||
if (IS_NODE) { | ||
timestamp = function timestamp() { | ||
var getTimestamp = void 0; | ||
var startTimestamp = void 0; | ||
if (!isBrowser) { | ||
getTimestamp = function getTimestamp() { | ||
var _process$hrtime = process.hrtime(), | ||
@@ -64,13 +64,16 @@ _process$hrtime2 = _slicedToArray(_process$hrtime, 2), | ||
}; | ||
startTimestamp = getTimestamp(); | ||
} else if (window.performance) { | ||
timestamp = function timestamp() { | ||
getTimestamp = function getTimestamp() { | ||
return window.performance.now(); | ||
}; | ||
startTimestamp = 0; | ||
} else { | ||
timestamp = function timestamp() { | ||
getTimestamp = function getTimestamp() { | ||
return Date.now(); | ||
}; | ||
startTimestamp = getTimestamp(); | ||
} | ||
export { timestamp }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9lbnYuanMiXSwibmFtZXMiOlsiY29uc29sZSIsIndpbmRvdyIsIklTX05PREUiLCJwcm9jZXNzIiwidW5kZWZpbmVkIiwidG9TdHJpbmciLCJkZWJ1ZyIsImxvZyIsIm5hdGl2ZSIsImJpbmQiLCJ3YXJuIiwiZXJyb3IiLCJsb2dnZXIiLCJ0aW1lc3RhbXAiLCJocnRpbWUiLCJzZWNvbmRzIiwibmFub3NlY29uZHMiLCJwZXJmb3JtYW5jZSIsIm5vdyIsIkRhdGUiXSwibWFwcGluZ3MiOiI7Ozs7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ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W1lc3RhbXB9O1xuIl19 |
@@ -1,21 +0,1 @@ | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
/** | ||
@@ -25,5 +5,13 @@ * Utilities for dev-mode error handling | ||
/* eslint-disable no-console, no-debugger */ | ||
/* global window */ | ||
import window from 'global/window'; | ||
import { logger as console } from './env'; | ||
// Some instrumentation may override console methods, so preserve them here | ||
console.native = { | ||
debug: console.debug.bind(console), | ||
log: console.log.bind(console), | ||
warn: console.warn.bind(console), | ||
error: console.error.bind(console) | ||
}; | ||
/** | ||
@@ -112,2 +100,2 @@ * Ensure that your debugger stops when code issues warnings so that | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9lcnJvci11dGlscy5qcyJdLCJuYW1lcyI6WyJsb2dnZXIiLCJjb25zb2xlIiwiYnJlYWtPb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AgICB9XG4gICAgY29uc29sZS5uYXRpdmUud2FybiguLi5hcmd1bWVudHMpO1xuICB9O1xufVxuXG4vLyBDaHJvbWUgaGFzIHlldCB0byBpbXBsZW1lbnQgb25SZWplY3RlZFByb21pc2UsIHNvIHRyaWdnZXIgb25lcnJvciBpbnN0ZWFkXG5leHBvcnQgZnVuY3Rpb24gaW50ZXJjZXB0UmVqZWN0ZWRQcm9taXNlcygpIHtcbiAgY29uc29sZS5lcnJvciA9IChtc2csIGVycm9yLCAuLi5wYXJhbXMpID0+IHtcbiAgICBpZiAodHlwZW9mIG1zZyA9PT0gJ3N0cmluZycgJiZcbiAgICAgIG1zZy5pbmRleE9mKCdVbmhhbmRsZWQgcHJvbWlzZSByZWplY3Rpb24nKSA9PT0gMCkge1xuICAgICAgZXJyb3IudW5oYW5kbGVkUHJvbWlzZSA9IHRydWU7XG4gICAgICAvLyBVc2UgZGlmZmVyZW50IG1lc3NhZ2UgdG8gYXZvaWQgdHJpZ2dlcmluZyBhZ2FpblxuICAgICAgY29uc29sZS5uYXRpdmUuZXJyb3IoJ1JlamVjdGVkIHByb21pc2UnLCBlcnJvciwgLi4ucGFyYW1zKTtcbiAgICAgIHRocm93IGVycm9yO1xuICAgIH1cbiAgICBjb25zb2xlLm5hdGl2ZS5lcnJvciguLi5hcmd1bWVudHMpO1xuICB9O1xufVxuIl19 |
@@ -1,28 +0,9 @@ | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
export { default as Log } from './log'; | ||
export { default as Probe } from './probe'; | ||
export { default as Bench } from './bench'; | ||
export { BROWSER, isBrowser, isMobile } from './browser'; | ||
export { breakOnConsoleWarnings, throwOnConsoleWarnings, interceptRejectedPromises } from './error-utils'; | ||
// Make Probe available as global variable for debugging purposes | ||
import Probe from './probe'; | ||
export { Probe }; | ||
export default new Probe(); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJCUk9XU0VSIiwiaXNCcm93c2VyIiwiaXNNb2JpbGUiLCJicmVha09uQ29uc29sZVdhcm5pbmdzIiwidGhyb3dPbkNvbnNvbGVXYXJuaW5ncyIsImludGVyY2VwdFJlamVjdGVkUHJvbWlzZXMiLCJQcm9iZSJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUEsU0FDRUEsT0FERixFQUVFQyxTQUZGLEVBR0VDLFFBSEYsUUFJTyxXQUpQOztBQU1BLFNBQ0VDLHNCQURGLEVBRUVDLHNCQUZGLEVBR0VDLHlCQUhGLFFBSU8sZUFKUDs7QUFNQSxPQUFPQyxLQUF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FdBUlJBTlRZIE9GIEFOWSBLSU5ELCBFWFBSRVNTIE9SXG4vLyBJTVBMSUVELCBJTkNMVURJTkcgQlVUIE5PVCBMSU1JVEVEIFRPIFRIRSBXQVJSQU5USUVTIE9GIE1FUkNIQU5UQUJJTElUWSxcbi8vIEZJVE5FU1MgRk9SIEEgUEFSVElDVUxBUiBQVVJQT1NFIEFORCBOT05JTkZSSU5HRU1FTlQuIElOIE5PIEVWRU5UIFNIQUxMIFRIRVxuLy8gQVVUSE9SUyBPUiBDT1BZUklHSFQgSE9MREVSUyBCRSBMSUFCTEUgRk9SIEFOWSBDTEFJTSwgREFNQUdFUyBPUiBPVEhFUlxuLy8gTElBQklMSVRZLCBXSEVUSEVSIElOIEFOIEFDVElPTiBPRiBDT05UUkFDVCwgVE9SVCBPUiBPVEhFUldJU0UsIEFSSVNJTkcgRlJPTSxcbi8vIE9VVCBPRiBPUiBJTiBDT05ORUNUSU9OIFdJVEggVEhFIFNPRlRXQVJFIE9SIFRIRSBVU0UgT1IgT1RIRVIgREVBTElOR1MgSU5cbi8vIFRIRSBTT0ZUV0FSRS5cblxuZXhwb3J0IHtcbiAgQlJPV1NFUixcbiAgaXNCcm93c2VyLFxuICBpc01vYmlsZVxufSBmcm9tICcuL2Jyb3dzZXInO1xuXG5leHBvcnQge1xuICBicmVha09uQ29uc29sZVdhcm5pbmdzLFxuICB0aHJvd09uQ29uc29sZVdhcm5pbmdzLFxuICBpbnRlcmNlcHRSZWplY3RlZFByb21pc2VzXG59IGZyb20gJy4vZXJyb3ItdXRpbHMnO1xuXG5pbXBvcnQgUHJvYmUgZnJvbSAnLi9wcm9iZSc7XG5leHBvcnQge1Byb2JlfTtcbmV4cG9ydCBkZWZhdWx0IG5ldyBQcm9iZSgpO1xuIl19 | ||
import { global } from './utils/globals'; | ||
global.Probe = Probe; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0IiwiTG9nIiwiUHJvYmUiLCJCZW5jaCIsImdsb2JhbCJdLCJtYXBwaW5ncyI6IkFBQUEsU0FBUUEsV0FBV0MsR0FBbkIsUUFBNkIsT0FBN0I7QUFDQSxTQUFRRCxXQUFXRSxLQUFuQixRQUErQixTQUEvQjtBQUNBLFNBQVFGLFdBQVdHLEtBQW5CLFFBQStCLFNBQS9COztBQUVBO0FBQ0EsT0FBT0QsS0FBUCxNQUFrQixTQUFsQjtBQUNBLFNBQVFFLE1BQVIsUUFBcUIsaUJBQXJCO0FBQ0FBLE9BQU9GLEtBQVAsR0FBZUEsS0FBZiIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7ZGVmYXVsdCBhcyBMb2d9IGZyb20gJy4vbG9nJztcbmV4cG9ydCB7ZGVmYXVsdCBhcyBQcm9iZX0gZnJvbSAnLi9wcm9iZSc7XG5leHBvcnQge2RlZmF1bHQgYXMgQmVuY2h9IGZyb20gJy4vYmVuY2gnO1xuXG4vLyBNYWtlIFByb2JlIGF2YWlsYWJsZSBhcyBnbG9iYWwgdmFyaWFibGUgZm9yIGRlYnVnZ2luZyBwdXJwb3Nlc1xuaW1wb3J0IFByb2JlIGZyb20gJy4vcHJvYmUnO1xuaW1wb3J0IHtnbG9iYWx9IGZyb20gJy4vdXRpbHMvZ2xvYmFscyc7XG5nbG9iYWwuUHJvYmUgPSBQcm9iZTtcbiJdfQ== |
@@ -6,7 +6,5 @@ 'use strict'; | ||
}); | ||
exports.timestamp = exports.logger = exports.IS_NODE = undefined; | ||
exports.startTimestamp = exports.getTimestamp = exports.VERSION = undefined; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; // Copyright (c) 2017 Uber Technologies, Inc. | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); // Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
@@ -38,2 +36,4 @@ // Permission is hereby granted, free of charge, to any person obtaining a copy | ||
var _globals = require('./utils/globals'); | ||
var _console = require('global/console'); | ||
@@ -43,32 +43,29 @@ | ||
var _window = require('global/window'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _window2 = _interopRequireDefault(_window); | ||
// Extract version from package.json (injected by webpack) | ||
/* global PROBE_VERSION */ | ||
var VERSION = exports.VERSION = typeof PROBE_VERSION !== 'undefined' ? PROBE_VERSION : 'Node'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function noop() {} | ||
// Duck-type Node context | ||
var IS_NODE = exports.IS_NODE = (typeof process === 'undefined' ? 'undefined' : _typeof(process)) !== undefined && process.toString() === '[object process]'; | ||
// Polyfill console | ||
// Configure console | ||
// Console.debug is useful in chrome as it gives blue styling, but is not | ||
// available in node | ||
// Console.debug is useful in chrome as it enables filtering and | ||
// (depending on Chrome version) distinctive styling, but is not available in node | ||
_console2.default.debug = _console2.default.debug || _console2.default.log; | ||
// Some instrumentation may override console methods, so preserve them here | ||
_console2.default.native = { | ||
debug: _console2.default.debug.bind(_console2.default), | ||
log: _console2.default.log.bind(_console2.default), | ||
warn: _console2.default.warn.bind(_console2.default), | ||
error: _console2.default.error.bind(_console2.default) | ||
}; | ||
// Groups, timeStamps, table are not available in node | ||
_console2.default.group = _console2.default.group || _console2.default.log; | ||
_console2.default.groupCollapsed = _console2.default.groupCollapsed || _console2.default.log; | ||
_console2.default.groupEnd = _console2.default.groupEnd || noop; | ||
exports.logger = _console2.default; | ||
_console2.default.timeStamp = _console2.default.timeStamp || noop; | ||
_console2.default.table = _console2.default.table || noop; | ||
// Set up high resolution timer | ||
var timestamp = void 0; | ||
if (IS_NODE) { | ||
exports.timestamp = timestamp = function timestamp() { | ||
var getTimestamp = void 0; | ||
var startTimestamp = void 0; | ||
if (!_globals.isBrowser) { | ||
exports.getTimestamp = getTimestamp = function getTimestamp() { | ||
var _process$hrtime = process.hrtime(), | ||
@@ -81,13 +78,17 @@ _process$hrtime2 = _slicedToArray(_process$hrtime, 2), | ||
}; | ||
} else if (_window2.default.performance) { | ||
exports.timestamp = timestamp = function timestamp() { | ||
return _window2.default.performance.now(); | ||
exports.startTimestamp = startTimestamp = getTimestamp(); | ||
} else if (_globals.window.performance) { | ||
exports.getTimestamp = getTimestamp = function getTimestamp() { | ||
return _globals.window.performance.now(); | ||
}; | ||
exports.startTimestamp = startTimestamp = 0; | ||
} else { | ||
exports.timestamp = timestamp = function timestamp() { | ||
exports.getTimestamp = getTimestamp = function getTimestamp() { | ||
return Date.now(); | ||
}; | ||
exports.startTimestamp = startTimestamp = getTimestamp(); | ||
} | ||
exports.timestamp = timestamp; | ||
//# sourceMappingURL=data:application/json;charset=utf-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b2Nlc3MuaHJ0aW1lKCk7XG4gICAgcmV0dXJuIHNlY29uZHMgKyBuYW5vc2Vjb25kcyAvIDFlNjtcbiAgfTtcbn0gZWxzZSBpZiAod2luZG93LnBlcmZvcm1hbmNlKSB7XG4gIHRpbWVzdGFtcCA9ICgpID0+IHdpbmRvdy5wZXJmb3JtYW5jZS5ub3coKTtcbn0gZWxzZSB7XG4gIHRpbWVzdGFtcCA9ICgpID0+IERhdGUubm93KCk7XG59XG5cbmV4cG9ydCB7dGltZXN0YW1wIGFzIHRpbWVzdGFtcH07XG4iXX0= | ||
exports.getTimestamp = getTimestamp; | ||
exports.startTimestamp = startTimestamp; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9lbnYuanMiXSwibmFtZXMiOlsiVkVSU0lPTiIsIlBST0JFX1ZFUlNJT04iLCJub29wIiwiZGVidWciLCJsb2ciLCJncm91cCIsImdyb3VwQ29sbGFwc2VkIiwiZ3JvdXBFbmQiLCJ0aW1lU3RhbXAiLCJ0YWJsZSIsImdldFRpbWVzdGFtcCIsInN0YXJ0VGltZXN0YW1wIiwicHJvY2VzcyIsImhydGltZSIsInNlY29uZHMiLCJuYW5vc2Vjb25kcyIsInBlcmZvcm1hbmNlIiwibm93IiwiRGF0ZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozt5cEJBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7OztBQUdBO0FBQ0E7OztBQUNBOztBQUNBOzs7Ozs7QUFFQTtBQUNBO0FBQ08sSUFBTUEsNEJBQVUsT0FBT0MsYUFBUCxLQUF5QixXQUF6QixHQUF1Q0EsYUFBdkMsR0FBdUQsTUFBdkU7O0FBRVAsU0FBU0MsSUFB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3RhcnRUaW1lc3RhbXAgPSBnZXRUaW1lc3RhbXAoKTtcbn0gZWxzZSBpZiAod2luZG93LnBlcmZvcm1hbmNlKSB7XG4gIGdldFRpbWVzdGFtcCA9ICgpID0+IHdpbmRvdy5wZXJmb3JtYW5jZS5ub3coKTtcbiAgc3RhcnRUaW1lc3RhbXAgPSAwO1xufSBlbHNlIHtcbiAgZ2V0VGltZXN0YW1wID0gKCkgPT4gRGF0ZS5ub3coKTtcbiAgc3RhcnRUaW1lc3RhbXAgPSBnZXRUaW1lc3RhbXAoKTtcbn1cblxuZXhwb3J0IHtnZXRUaW1lc3RhbXAsIHN0YXJ0VGltZXN0YW1wfTtcbiJdfQ== |
@@ -10,5 +10,23 @@ 'use strict'; | ||
var _window = require('global/window'); | ||
var _window2 = _interopRequireDefault(_window); | ||
var _env = require('./env'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// Some instrumentation may override console methods, so preserve them here | ||
/** | ||
* Utilities for dev-mode error handling | ||
*/ | ||
/* eslint-disable no-console, no-debugger */ | ||
_env.logger.native = { | ||
debug: _env.logger.debug.bind(_env.logger), | ||
log: _env.logger.log.bind(_env.logger), | ||
warn: _env.logger.warn.bind(_env.logger), | ||
error: _env.logger.error.bind(_env.logger) | ||
}; | ||
/** | ||
* Ensure that your debugger stops when code issues warnings so that | ||
@@ -42,3 +60,3 @@ * you can see what is going on in othercomponents when they decide | ||
window.onerror = function (message, url, line, column, error) { | ||
_window2.default.onerror = function (message, url, line, column, error) { | ||
if (error) { | ||
@@ -60,27 +78,2 @@ _env.logger.native.error(error + ' ' + url + ':' + line + ':' + (column || 0)); | ||
*/ | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
/** | ||
* Utilities for dev-mode error handling | ||
*/ | ||
/* eslint-disable no-console, no-debugger */ | ||
/* global window */ | ||
function throwOnConsoleWarnings() { | ||
@@ -123,2 +116,2 @@ var consoleBlacklist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [/.*/]; | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9lcnJvci11dGlscy5qcyJdLCJuYW1lcyI6WyJicmVha09uQ29uc29sZVdhcm5pbmdzIiwidGhyb3dPbkNvbnNvbGVXYXJuaW5ncyIsImludGVyY2VwdFJlamVjdGVkUHJvbWlzZXMiLCJjb25zb2xlQmxhY2tsaXN0IiwiYnJlYWtPbkNvbnNvbGUiLCJsb2ciLCJtc2ciLCJwYXJhbTEiLCJwYXJhbXMiLCJpbmRleE9mIiwiRXJyb3IiLCJzb21lIiwicGF0dGVybiIsInRlc3QiLCJ3YXJuIiwiYmluZCIsIm5hdGl2ZSIsImVycm9yIiwid2luZG93Iiwib25lcnJvciIsIm1lc3NhZ2UiLCJ1cmwiLCJsaW5lIiwiY29sdW1uIiwidGh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jb25zb2xlQmxhY2tsaXN0ID0gWy8uKi9dKSB7XG4gIGNvbnNvbGUud2FybiA9IGZ1bmN0aW9uIHRocm93T25XYXJuaW5nKG1zZykge1xuICAgIGlmIChjb25zb2xlQmxhY2tsaXN0LnNvbWUocGF0dCA9PiBwYXR0LnRlc3QobXNnKSkpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcihgVW5hY2NlcHRhYmxlIHdhcm5pbmc6ICR7bXNnfWApO1xuICAgIH1cbiAgICBjb25zb2xlLm5hdGl2ZS53YXJuKC4uLmFyZ3VtZW50cyk7XG4gIH07XG59XG5cbi8vIENocm9tZSBoYXMgeWV0IHRvIGltcGxlbWVudCBvblJlamVjdGVkUHJvbWlzZSwgc28gdHJpZ2dlciBvbmVycm9yIGluc3RlYWRcbmV4cG9ydCBmdW5jdGlvbiBpbnRlcmNlcHRSZWplY3RlZFByb21pc2VzKCkge1xuICBjb25zb2xlLmVycm9yID0gKG1zZywgZXJyb3IsIC4uLnBhcmFtcykgPT4ge1xuICAgIGlmICh0eXBlb2YgbXNnID09PSAnc3RyaW5nJyAmJlxuICAgICAgbXNnLmluZGV4T2YoJ1VuaGFuZGxlZCBwcm9taXNlIHJlamVjdGlvbicpID09PSAwKSB7XG4gICAgICBlcnJvci51bmhhbmRsZWRQcm9taXNlID0gdHJ1ZTtcbiAgICAgIC8vIFVzZSBkaWZmZXJlbnQgbWVzc2FnZSB0byBhdm9pZCB0cmlnZ2VyaW5nIGFnYWluXG4gICAgICBjb25zb2xlLm5hdGl2ZS5lcnJvcignUmVqZWN0ZWQgcHJvbWlzZScsIGVycm9yLCAuLi5wYXJhbXMpO1xuICAgICAgdGhyb3cgZXJyb3I7XG4gICAgfVxuICAgIGNvbnNvbGUubmF0aXZlLmVycm9yKC4uLmFyZ3VtZW50cyk7XG4gIH07XG59XG4iXX0= | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9lc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3IudW5oYW5kbGVkUHJvbWlzZSA9IHRydWU7XG4gICAgICAvLyBVc2UgZGlmZmVyZW50IG1lc3NhZ2UgdG8gYXZvaWQgdHJpZ2dlcmluZyBhZ2FpblxuICAgICAgY29uc29sZS5uYXRpdmUuZXJyb3IoJ1JlamVjdGVkIHByb21pc2UnLCBlcnJvciwgLi4ucGFyYW1zKTtcbiAgICAgIHRocm93IGVycm9yO1xuICAgIH1cbiAgICBjb25zb2xlLm5hdGl2ZS5lcnJvciguLi5hcmd1bWVudHMpO1xuICB9O1xufVxuIl19 |
@@ -6,54 +6,41 @@ 'use strict'; | ||
}); | ||
exports.Probe = exports.interceptRejectedPromises = exports.throwOnConsoleWarnings = exports.breakOnConsoleWarnings = exports.isMobile = exports.isBrowser = exports.BROWSER = undefined; | ||
exports.Bench = exports.Probe = exports.Log = undefined; | ||
var _browser = require('./browser'); | ||
var _log = require('./log'); | ||
Object.defineProperty(exports, 'BROWSER', { | ||
Object.defineProperty(exports, 'Log', { | ||
enumerable: true, | ||
get: function get() { | ||
return _browser.BROWSER; | ||
return _interopRequireDefault(_log).default; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'isBrowser', { | ||
var _probe = require('./probe'); | ||
Object.defineProperty(exports, 'Probe', { | ||
enumerable: true, | ||
get: function get() { | ||
return _browser.isBrowser; | ||
return _interopRequireDefault(_probe).default; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'isMobile', { | ||
enumerable: true, | ||
get: function get() { | ||
return _browser.isMobile; | ||
} | ||
}); | ||
var _errorUtils = require('./error-utils'); | ||
var _bench = require('./bench'); | ||
Object.defineProperty(exports, 'breakOnConsoleWarnings', { | ||
Object.defineProperty(exports, 'Bench', { | ||
enumerable: true, | ||
get: function get() { | ||
return _errorUtils.breakOnConsoleWarnings; | ||
return _interopRequireDefault(_bench).default; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'throwOnConsoleWarnings', { | ||
enumerable: true, | ||
get: function get() { | ||
return _errorUtils.throwOnConsoleWarnings; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'interceptRejectedPromises', { | ||
enumerable: true, | ||
get: function get() { | ||
return _errorUtils.interceptRejectedPromises; | ||
} | ||
}); | ||
var _probe = require('./probe'); | ||
var _probe2 = _interopRequireDefault(_probe); | ||
var _globals = require('./utils/globals'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.Probe = _probe2.default; | ||
exports.default = new _probe2.default(); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJCUk9XU0VSIiwiaXNCcm93c2VyIiwiaXNNb2JpbGUiLCJicmVha09uQ29uc29sZVdhcm5pbmdzIiwidGhyb3dPbkNvbnNvbGVXYXJuaW5ncyIsImludGVyY2VwdFJlamVjdGVkUHJvbWlzZXMiLCJQcm9iZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O29CQXFCRUEsTzs7Ozs7O29CQUNBQyxTOzs7Ozs7b0JBQ0FDLFE7Ozs7Ozs7Ozt1QkFJQUMsc0I7Ozs7Ozt1QkFDQUMsc0I7Ozs7Ozt1QkFDQUMseUI7Ozs7QUFHRjs7Ozs7O1FBQ1FDLEs7a0JBQ08scUIiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBDb3B5cmlnaHQgKGMpIDIwMTcgVWJlciBUZWNobm9sb2dpZXMsIEluYy5cbi8vXG4vLyBQZXJtaXNzaW9uIGlzIGhlcmVieSBncmFudGVkLCBmcmVlIG9mIGNoYXJnZSwgdG8gYW55IHBlcnNvbiBvYnRhaW5pbmcgYSBjb3B5XG4vLyBvZiB0aGlzIHNvZnR3YXJlIGFuZCBhc3NvY2lhdGVkIGRvY3VtZW50YXRpb24gZmlsZXMgKHRoZSBcIlNvZnR3YXJlXCIpLCB0byBkZWFsXG4vLyBpbiB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NULCBUT1JUIE9SIE9USEVSV0lTRSwgQVJJU0lORyBGUk9NLFxuLy8gT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgU09GVFdBUkUgT1IgVEhFIFVTRSBPUiBPVEhFUiBERUFMSU5HUyBJTlxuLy8gVEhFIFNPRlRXQVJFLlxuXG5leHBvcnQge1xuICBCUk9XU0VSLFxuICBpc0Jyb3dzZXIsXG4gIGlzTW9iaWxlXG59IGZyb20gJy4vYnJvd3Nlcic7XG5cbmV4cG9ydCB7XG4gIGJyZWFrT25Db25zb2xlV2FybmluZ3MsXG4gIHRocm93T25Db25zb2xlV2FybmluZ3MsXG4gIGludGVyY2VwdFJlamVjdGVkUHJvbWlzZXNcbn0gZnJvbSAnLi9lcnJvci11dGlscyc7XG5cbmltcG9ydCBQcm9iZSBmcm9tICcuL3Byb2JlJztcbmV4cG9ydCB7UHJvYmV9O1xuZXhwb3J0IGRlZmF1bHQgbmV3IFByb2JlKCk7XG4iXX0= | ||
// Make Probe available as global variable for debugging purposes | ||
_globals.global.Probe = _probe2.default; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0IiwiUHJvYmUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozt3Q0FBUUEsTzs7Ozs7Ozs7OzBDQUNBQSxPOzs7Ozs7Ozs7MENBQ0FBLE87Ozs7OztBQUlSOzs7O0FBRkE7OztBQUdBLGdCQUFPQyxLQUFQIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHtkZWZhdWx0IGFzIExvZ30gZnJvbSAnLi9sb2cnO1xuZXhwb3J0IHtkZWZhdWx0IGFzIFByb2JlfSBmcm9tICcuL3Byb2JlJztcbmV4cG9ydCB7ZGVmYXVsdCBhcyBCZW5jaH0gZnJvbSAnLi9iZW5jaCc7XG5cbi8vIE1ha2UgUHJvYmUgYXZhaWxhYmxlIGFzIGdsb2JhbCB2YXJpYWJsZSBmb3IgZGVidWdnaW5nIHB1cnBvc2VzXG5pbXBvcnQgUHJvYmUgZnJvbSAnLi9wcm9iZSc7XG5pbXBvcnQge2dsb2JhbH0gZnJvbSAnLi91dGlscy9nbG9iYWxzJztcbmdsb2JhbC5Qcm9iZSA9IFByb2JlO1xuIl19 |
{ | ||
"name": "probe.gl", | ||
"description": "Javascript Instrumentation for Node and Browser", | ||
"description": "JavaScript Console Instrumentation and Benchmarking for Browser and Node", | ||
"license": "MIT", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"keywords": [ | ||
@@ -43,2 +43,4 @@ "javascript", | ||
"dependencies": { | ||
"babel-runtime": "^6.11.6", | ||
"d3-format": "^1.2.0" | ||
}, | ||
@@ -45,0 +47,0 @@ "devDependencies": { |
@@ -1,9 +0,24 @@ | ||
# probe.gl | ||
<p align="right"> | ||
<a href="https://npmjs.org/package/probe.gl"> | ||
<img src="https://img.shields.io/npm/v/probe.gl.svg?style=flat-square" alt="version" /> | ||
</a> | ||
<a href="https://travis-ci.org/uber/probe.gl"> | ||
<img src="https://img.shields.io/travis/uber-web/probe.gl/master.svg?style=flat-square" alt="build" /> | ||
</a> | ||
<a href="https://npmjs.org/package/probe.gl"> | ||
<img src="https://img.shields.io/npm/dm/probe.gl.svg?style=flat-square" alt="downloads" /> | ||
</a> | ||
<a href="http://starveller.sigsev.io/uber-web/probe.gl"> | ||
<img src="http://starveller.sigsev.io/api/repos/uber-web/probe.gl/badge" alt="stars" /> | ||
</a> | ||
</p> | ||
Lets you instrument your JavaScript applications to get timings in browser console or in node and much more. | ||
<h1 align="center">probe.gl | <a href="https://uber-web.github.io/probe.gl">Docs</a></h1> | ||
For detail see the Docs website. | ||
probe.gl lets you instrument your JavaScript applications to get timings in browser console or in node, and much more. | ||
Please refer to the <a href="https://uber-web.github.io/probe.gl">docs</a> website. | ||
``` | ||
npm install probe.gl | ||
``` |
@@ -26,38 +26,42 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
/* global process */ | ||
import {window, isBrowser} from './utils/globals'; | ||
import console from 'global/console'; | ||
import window from 'global/window'; | ||
// Duck-type Node context | ||
export const IS_NODE = typeof process !== undefined && | ||
process.toString() === '[object process]'; | ||
// Extract version from package.json (injected by webpack) | ||
/* global PROBE_VERSION */ | ||
export const VERSION = typeof PROBE_VERSION !== 'undefined' ? PROBE_VERSION : 'Node'; | ||
// Configure console | ||
function noop() {} | ||
// Console.debug is useful in chrome as it gives blue styling, but is not | ||
// available in node | ||
// Polyfill console | ||
// Console.debug is useful in chrome as it enables filtering and | ||
// (depending on Chrome version) distinctive styling, but is not available in node | ||
console.debug = console.debug || console.log; | ||
// Some instrumentation may override console methods, so preserve them here | ||
console.native = { | ||
debug: console.debug.bind(console), | ||
log: console.log.bind(console), | ||
warn: console.warn.bind(console), | ||
error: console.error.bind(console) | ||
}; | ||
// Groups, timeStamps, table are not available in node | ||
console.group = console.group || console.log; | ||
console.groupCollapsed = console.groupCollapsed || console.log; | ||
console.groupEnd = console.groupEnd || noop; | ||
export {console as logger}; | ||
console.timeStamp = console.timeStamp || noop; | ||
console.table = console.table || noop; | ||
// Set up high resolution timer | ||
let timestamp; | ||
if (IS_NODE) { | ||
timestamp = () => { | ||
let getTimestamp; | ||
let startTimestamp; | ||
if (!isBrowser) { | ||
getTimestamp = () => { | ||
const [seconds, nanoseconds] = process.hrtime(); | ||
return seconds + nanoseconds / 1e6; | ||
}; | ||
startTimestamp = getTimestamp(); | ||
} else if (window.performance) { | ||
timestamp = () => window.performance.now(); | ||
getTimestamp = () => window.performance.now(); | ||
startTimestamp = 0; | ||
} else { | ||
timestamp = () => Date.now(); | ||
getTimestamp = () => Date.now(); | ||
startTimestamp = getTimestamp(); | ||
} | ||
export {timestamp as timestamp}; | ||
export {getTimestamp, startTimestamp}; |
@@ -1,21 +0,1 @@ | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
/** | ||
@@ -25,5 +5,13 @@ * Utilities for dev-mode error handling | ||
/* eslint-disable no-console, no-debugger */ | ||
/* global window */ | ||
import window from 'global/window'; | ||
import {logger as console} from './env'; | ||
// Some instrumentation may override console methods, so preserve them here | ||
console.native = { | ||
debug: console.debug.bind(console), | ||
log: console.log.bind(console), | ||
warn: console.warn.bind(console), | ||
error: console.error.bind(console) | ||
}; | ||
/** | ||
@@ -30,0 +18,0 @@ * Ensure that your debugger stops when code issues warnings so that |
@@ -1,35 +0,8 @@ | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
export {default as Log} from './log'; | ||
export {default as Probe} from './probe'; | ||
export {default as Bench} from './bench'; | ||
export { | ||
BROWSER, | ||
isBrowser, | ||
isMobile | ||
} from './browser'; | ||
export { | ||
breakOnConsoleWarnings, | ||
throwOnConsoleWarnings, | ||
interceptRejectedPromises | ||
} from './error-utils'; | ||
// Make Probe available as global variable for debugging purposes | ||
import Probe from './probe'; | ||
export {Probe}; | ||
export default new Probe(); | ||
import {global} from './utils/globals'; | ||
global.Probe = Probe; |
738
src/probe.js
@@ -21,94 +21,110 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
/* eslint-disable no-console */ | ||
import {IS_NODE, logger, timestamp} from './env'; | ||
/* eslint-disable no-console, no-try-catch */ | ||
/* global console */ | ||
import {isBrowser} from './utils/globals'; | ||
import {formatTime, formatSI, leftPad} from './utils/formatters'; | ||
import LocalStorage from './utils/local-storage'; | ||
import NodeStorage from './utils/node-storage'; | ||
import {VERSION, getTimestamp, startTimestamp} from './env'; | ||
import Group from './group'; | ||
import assert from 'assert'; | ||
// TODO - this used to use d3.format(.3s) | ||
function formatSI(value) { | ||
return value.toFixed(3); | ||
} | ||
const logger = console; | ||
// TODO: Currently unused, keeping in case we want it later for log formatting | ||
export function formatTime(ms) { | ||
let formatted; | ||
if (ms < 10) { | ||
formatted = `${ms.toFixed(2)}ms`; | ||
} else if (ms < 100) { | ||
formatted = `${ms.toFixed(1)}ms`; | ||
} else if (ms < 1000) { | ||
formatted = `${(ms / 1000).toFixed(3)}s`; | ||
} else { | ||
formatted = `${(ms / 1000).toFixed(2)}s`; | ||
} | ||
return formatted; | ||
} | ||
const DEFAULT_CONFIG = { | ||
// off by default | ||
isEnabled: false, | ||
// logging level | ||
level: 1, | ||
// Whether logging is turned on | ||
isLogEnabled: true, | ||
// Whether logging prints to console | ||
isPrintEnabled: true, | ||
// Whether Probe#run executes code | ||
isRunEnabled: true | ||
isEnabled: {value: false, doc: 'Whether probe is enabled (off by default)'}, | ||
level: {value: 1, doc: 'Controls what is logged, higher numbers = more logs'}, | ||
isLogEnabled: {value: true, doc: 'Whether logging is turned on'}, | ||
isPrintEnabled: {value: true, doc: 'Whether logging prints to console'}, | ||
isRunEnabled: {value: true, doc: 'Whether Probe.run executes code'}, | ||
useIndirectLogging: {value: false, doc: 'Whether Probe returns functions'}, | ||
ignoreEnvironment: {value: false, doc: 'Reset to default config'} | ||
}; | ||
function noop() {} | ||
// In a browser environment, probe will store its configuration in this cookie | ||
// This allows settings to persist across browser reloads | ||
const PROBE_STORAGE_KEY_NAME = '__probe__'; | ||
const TO_DISABLE = [ | ||
'_probe', '_fps', '_externalProbe', '_log', 'run', 'getOption', | ||
'getIterationsPerSecond', 'logIterationsPerSecond' | ||
function noop() { | ||
return noop; | ||
} | ||
// List of probe methods that should become noops when probe is disabled | ||
const METHODS_TO_DISABLE = [ | ||
'run', 'getOption', | ||
'getIterationsPerSecond', 'logIterationsPerSecond', | ||
'_probe', '_fps', '_externalProbe', '_log' | ||
]; | ||
const INTERACTIVE_CHECK_TIMEOUT = 50; | ||
export default class Probe { | ||
// @param {Object} config Optional configuration args; see #configure | ||
constructor(config = {}) { | ||
assert(typeof config.id === 'string'); | ||
this.id = config.id; | ||
/** | ||
* @constructor | ||
* @param {Object} config Optional configuration args; see #configure | ||
*/ | ||
constructor(config = {}) { | ||
// Data containers | ||
this._logStore = []; | ||
this._sampleStore = {}; | ||
this._fpsStore = {}; | ||
this._startStore = {}; | ||
// Timestamps - pegged to an arbitrary time in the past | ||
this._startTs = timestamp(); | ||
this._deltaTs = timestamp(); | ||
this.VERSION = VERSION; | ||
this.storage = isBrowser ? new LocalStorage() : new NodeStorage(); | ||
this.reset(); | ||
// Timestamps - pegged to best estimate of system/program start time | ||
this._startTs = startTimestamp; | ||
// Other systems passing in epoch info require an epoch ts to convert | ||
this._startEpochTs = Date.now(); | ||
this._iterationsTs = null; | ||
// Configuration | ||
this._config = config.ignoreEnvironment ? | ||
Object.assign({}, DEFAULT_CONFIG) : | ||
this._getConfigFromEnvironment(); | ||
// Get initial configuration from environment | ||
this._initConfig({ignoreEnvironment: config.ignoreEnvironment}); | ||
// Override with new configuration, if any | ||
this.configure(config); | ||
// Disable methods if necessary | ||
if (!this._config.isEnabled) { | ||
if (!this._getOption('isEnabled')) { | ||
this.disable(); | ||
} | ||
// Calls a timer and counts how many times it fires. | ||
// This is used to calculate percentage of elapsed time that system | ||
// was not loaded. | ||
this._startInteractiveHearbeat(); | ||
} | ||
/** | ||
* Turn probe on | ||
* @return {Probe} self, to support chaining | ||
*/ | ||
enable() { | ||
// Reset all internal stores, dropping logs | ||
reset() { | ||
// Data containers | ||
this._logStore = []; | ||
this._sampleStore = {}; | ||
this._fpsStore = {}; | ||
this._startStore = {}; | ||
this._groupStore = {}; | ||
this._firstStore = {}; | ||
// Timestamps | ||
this._startTs = getTimestamp(); | ||
this._deltaTs = getTimestamp(); | ||
this._iterationsTs = null; | ||
} | ||
toString() { | ||
const enabled = this.isEnabled() ? 'enabled' : 'disabled'; | ||
return `<Probe: ${enabled} level: ${this.getLevel()}>`; | ||
} | ||
// Turn probe on | ||
// @param {Object} opts={} - map of options to set | ||
// @return {Probe} self, to support chaining | ||
enable(opts = {}) { | ||
// Swap in live methods | ||
for (const method of TO_DISABLE) { | ||
for (const method of METHODS_TO_DISABLE) { | ||
this[method] = Probe.prototype[method]; | ||
} | ||
return this.configure({isEnabled: true}); | ||
return this.configure(Object.assign({isEnabled: true}, opts)); | ||
} | ||
/** | ||
* Turn probe off | ||
* @return {Probe} self, to support chaining | ||
*/ | ||
// Turn probe off | ||
// @return {Probe} self, to support chaining | ||
disable() { | ||
// Swap in noops for live methods | ||
for (const method of TO_DISABLE) { | ||
for (const method of METHODS_TO_DISABLE) { | ||
this[method] = noop; | ||
@@ -119,2 +135,9 @@ } | ||
// Whether Probe is currently enabled | ||
// @return {Boolean} isEnabled | ||
isEnabled() { | ||
// getOption is set to noop when Probe is disabled, check _config directly | ||
return Boolean(this._getOption('isEnabled')); | ||
} | ||
/** | ||
@@ -129,6 +152,90 @@ * Convenience function: Set probe level | ||
getLevel() { | ||
return this._getOption('level'); | ||
} | ||
// OPTIONS INTERFACE | ||
/** | ||
* Registers an option, including description and default value. | ||
* Note, differs from setOption in that it does not change the value | ||
* of the option if the option is already set. However, the description | ||
* will always be updated. | ||
* | ||
* @param {String} key - The name of the option | ||
* @param {*} defaultValue= - Set as value if option does not already exist | ||
* @param {String} description= - Optional description for Probe.showOptions() | ||
* @return {Probe} - returns itself for chaining. | ||
*/ | ||
addOption(key, defaultValue = null, description = null) { | ||
assert(typeof key === 'string', 'Probe.addOption needs key argument'); | ||
// Go through some hoops so that we can call configure in the end | ||
let value; | ||
if (this._config[key]) { | ||
this._config[key].doc = description || this._config[key].doc || 'N/A'; | ||
value = this._config[key].value; | ||
} else { | ||
this._config[key] = { | ||
value: defaultValue, | ||
doc: description || 'N/A' | ||
}; | ||
value = defaultValue; | ||
} | ||
this.configure({[key]: value}); | ||
return this; | ||
} | ||
/** | ||
* Sets an option. | ||
* @param {String} key - The name of the option | ||
* @param {*} value - Set as value if option does not already exist | ||
* @return {Probe} - returns itself for chaining. | ||
*/ | ||
setOption(key, value) { | ||
assert(typeof key === 'string', 'Probe.setOption needs key argument'); | ||
return this.configure({[key]: value}); | ||
} | ||
/** | ||
* Get a single option from probe's persistent configuration. | ||
* By supplying default value and description the app can ensure the | ||
* option gets documented (for Probe.showOptions()) | ||
* | ||
* @param {String} key - name of the option | ||
* @param {String} defaultValue - name of the option | ||
* @param {String} description - name of the option | ||
* @return {*} - Option value, or defaultValue if no option with tha key | ||
*/ | ||
getOption(key, defaultValue = null, description = null) { | ||
return this._getOption(key, defaultValue, description); | ||
} | ||
// 'getOption' can be disabled, but is still needed internally | ||
// so we also provide _getOption | ||
_getOption(key, defaultValue = null, description = null) { | ||
assert(typeof key === 'string', 'Probe.getOption needs key argument'); | ||
if (description) { | ||
this.addOption({key, value: defaultValue, description}); | ||
} | ||
return this._config[key] ? this._config[key].value : defaultValue; | ||
} | ||
/** | ||
* Lists all options, with value and descriptions in a table | ||
* @return {Probe} - returns itself for chaining. | ||
*/ | ||
showOptions() { | ||
logger.table(this._config); | ||
return this; | ||
} | ||
help() { | ||
logger.table(this._config); | ||
return this; | ||
} | ||
/** | ||
* Configure probe with new values (can include custom key/value pairs). | ||
* Configuration will be persisted across browser sessions | ||
* @param {Object} config - named parameters | ||
* @param {Object} config={} - Map of options to configure | ||
* @param {Boolean} config.isEnabled Whether probe is enabled | ||
@@ -141,20 +248,13 @@ * @param {Number} config.level Logging level | ||
configure(config = {}) { | ||
const newConfig = Object.assign({}, this._config, config); | ||
this._config = newConfig; | ||
// if (!IS_NODE) { | ||
// const serialized = JSON.stringify(newConfig); | ||
// cookie.set(COOKIE_NAME, serialized); | ||
// } | ||
// Support chaining | ||
return this; | ||
for (const key in config) { | ||
const value = config[key]; | ||
this._config[key] = this._config[key] || {doc: 'N/A'}; | ||
this._config[key].value = value; | ||
} | ||
return this._updateEnvironment(); | ||
} | ||
/** | ||
* Get a single option from preset configuration. Useful when using Probe to | ||
* set developer-only switches. | ||
* @param {String} key Key to get value for | ||
* @return {mixed} Option value, or undefined | ||
*/ | ||
getOption(key) { | ||
return this._config[key]; | ||
resetConfig() { | ||
this._config = Object.assign({}, DEFAULT_CONFIG); | ||
return this._updateEnvironment(); | ||
} | ||
@@ -171,29 +271,6 @@ | ||
/** | ||
* Whether Probe is currently enabled | ||
* @return {Boolean} isEnabled | ||
*/ | ||
isEnabled() { | ||
return Boolean(this._config.isEnabled); | ||
} | ||
/** | ||
* Reset all internal stores, dropping logs | ||
*/ | ||
reset() { | ||
// Data containers | ||
this._logStore = []; | ||
this._sampleStore = {}; | ||
this._fpsStore = {}; | ||
this._startStore = {}; | ||
// Timestamps | ||
this._startTs = timestamp(); | ||
this._deltaTs = timestamp(); | ||
this._iterationsTs = null; | ||
} | ||
/** | ||
* Reset the long timer | ||
*/ | ||
resetStart() { | ||
this._startTs = this._deltaTs = timestamp(); | ||
this._startTs = this._deltaTs = getTimestamp(); | ||
} | ||
@@ -205,3 +282,3 @@ | ||
resetDelta() { | ||
this._deltaTs = timestamp(); | ||
this._deltaTs = getTimestamp(); | ||
} | ||
@@ -213,3 +290,3 @@ | ||
getTotal() { | ||
return timestamp() - this._startTs; | ||
return getTimestamp() - this._startTs; | ||
} | ||
@@ -221,104 +298,50 @@ | ||
getDelta() { | ||
return timestamp() - this._deltaTs; | ||
return getTimestamp() - this._deltaTs; | ||
} | ||
_getElapsedTime() { | ||
const total = timestamp() - this._startTs; | ||
const delta = timestamp() - this._deltaTs; | ||
// reset delta timer | ||
this._deltaTs = timestamp(); | ||
return {total, delta}; | ||
} | ||
_log(level, name, meta = {}) { | ||
const times = this._getElapsedTime(); | ||
const logRow = Object.assign({level, name}, times, meta); | ||
// duration handling | ||
if (meta.start) { | ||
this._startStore[name] = timestamp(); | ||
} else if (meta.end) { | ||
// If start isn't found, take the full duration since initialization | ||
const start = this._startStore[name] || this._startTs; | ||
logRow.duration = timestamp() - start; | ||
} | ||
this._logStore.push(logRow); | ||
// Log to console if enabled | ||
if (this._config.isPrintEnabled) { | ||
// TODO: Nicer console logging | ||
logger.debug(JSON.stringify(logRow)); | ||
} | ||
} | ||
_shouldLog(probeLevel) { | ||
const {isEnabled, isLogEnabled, level} = this._config; | ||
return isEnabled && isLogEnabled && level >= probeLevel; | ||
} | ||
/** | ||
* Displays a double timing (from "start time" and from last probe). | ||
_probe(level, name, meta) { | ||
* @returns {Function} - log function (should be called immediately by app) | ||
*/ | ||
probe(...args) { | ||
this._probe(1, ...args); | ||
return this._probe(1, ...args); | ||
} | ||
probe1(...args) { | ||
this._probe(1, ...args); | ||
return this._probe(1, ...args); | ||
} | ||
probe2(...args) { | ||
this._probe(2, ...args); | ||
return this._probe(2, ...args); | ||
} | ||
probe3(...args) { | ||
this._probe(3, ...args); | ||
return this._probe(3, ...args); | ||
} | ||
_probe(level, name, meta) { | ||
if (this._shouldLog(level)) { | ||
this._log(level, name, meta); | ||
} | ||
} | ||
/** | ||
* Display an averaged value of the time since last probe. | ||
* Keyed on the first string argument. | ||
* @param {Number} level | ||
* @param {String} message | ||
* @param {Object} meta | ||
* @returns {Function} - log function (should be called immediately by app) | ||
*/ | ||
sample(...args) { | ||
this._sample(1, ...args); | ||
return this._sample(1, ...args); | ||
} | ||
sample1(...args) { | ||
this._sample(1, ...args); | ||
return this._sample(1, ...args); | ||
} | ||
sample2(...args) { | ||
this._sample(2, ...args); | ||
return this._sample(2, ...args); | ||
} | ||
sample3(...args) { | ||
this._sample(3, ...args); | ||
return this._sample(3, ...args); | ||
} | ||
_sample(level, name, meta) { | ||
if (this._shouldLog(level)) { | ||
const samples = this._sampleStore; | ||
const probeData = samples[name] || ( | ||
samples[name] = {timeSum: 0, count: 0, averageTime: 0} | ||
); | ||
probeData.timeSum += timestamp() - this._deltaTs; | ||
probeData.count += 1; | ||
probeData.averageTime = probeData.timeSum / probeData.count; | ||
this._log(level, name, Object.assign({}, meta, {averageTime: probeData.averageTime})); | ||
// Weight more heavily on later samples. Otherwise it gets almost | ||
// impossible to see outliers after a while. | ||
if (probeData.count === 10) { | ||
probeData.count = 5; | ||
probeData.timeSum /= 2; | ||
} | ||
} | ||
} | ||
/** | ||
@@ -328,91 +351,120 @@ * These functions will average the time between calls and log that value | ||
* function is called - sometimes representing a "frames per second" count. | ||
* param {Number} level | ||
* param {String} message='default' | ||
* param {Object} meta | ||
_fps(level, name = 'default', {count = 10, ...meta} = {}) { | ||
* @returns {Function} - log function (should be called immediately by app) | ||
*/ | ||
fps(...args) { | ||
this._fps(1, ...args); | ||
return this._fps(1, ...args); | ||
} | ||
fps1(...args) { | ||
this._fps(1, ...args); | ||
return this._fps(1, ...args); | ||
} | ||
fps2(...args) { | ||
this._fps(2, ...args); | ||
return this._fps(2, ...args); | ||
} | ||
fps3(...args) { | ||
this._fps(3, ...args); | ||
return this._fps(3, ...args); | ||
} | ||
_fps(level, name = 'default', opts = {}) { | ||
const {count = 10} = opts; | ||
if (this._shouldLog(level)) { | ||
const fpsLog = this._fpsStore; | ||
const fpsData = fpsLog[name]; | ||
if (!fpsData) { | ||
fpsLog[name] = {count: 1, time: timestamp()}; | ||
} else if (++fpsData.count >= count) { | ||
const fps = fpsData.count / (timestamp() - fpsData.time); | ||
fpsData.count = 0; | ||
fpsData.time = timestamp(); | ||
this._log(level, name, Object.assign({fps}, opts)); | ||
} | ||
} | ||
} | ||
/** | ||
* Display a measurement from an external source, such as a server, | ||
* inline with other local measurements in the style of Probe's output. | ||
_externalProbe(level, name, timeStart, timeSpent, meta) { | ||
* @returns {Function} - log function (should be called immediately by app) | ||
*/ | ||
externalProbe(...args) { | ||
this._externalProbe(1, ...args); | ||
return this._externalProbe(1, ...args); | ||
} | ||
externalProbe1(...args) { | ||
this._externalProbe(1, ...args); | ||
return this._externalProbe(1, ...args); | ||
} | ||
externalProbe2(...args) { | ||
this._externalProbe(2, ...args); | ||
return this._externalProbe(2, ...args); | ||
} | ||
externalProbe3(...args) { | ||
this._externalProbe(3, ...args); | ||
return this._externalProbe(3, ...args); | ||
} | ||
_externalProbe(level, name, timeStart, timeSpent, meta) { | ||
if (this._shouldLog(level)) { | ||
// External probes are expected to provide epoch timestamps | ||
const total = timeStart - this._startEpochTs; | ||
const delta = timeSpent; | ||
this._log(level, name, Object.assign({total, delta}, meta)); | ||
// Only log first time | ||
first(level, name, message = '', meta = {}) { | ||
let logFunc = noop; | ||
if (!this._firstStore[name]) { | ||
this._firstStore[name] = { | ||
time: formatTime(getTimestamp()), | ||
message | ||
}; | ||
const nameAndMessage = `${name} ${message}`; | ||
logger.timeStamp(nameAndMessage); | ||
logFunc = this._probe(...[level, nameAndMessage, Object.assign({}, meta, {info: true})]); | ||
} | ||
return logFunc; | ||
} | ||
/* Conditionally run a function only when probe is enabled */ | ||
firstTable(tail) { | ||
this._firstStore['INTERACTIVE PERCENTAGE'] = { | ||
time: formatTime(getTimestamp()), | ||
message: `${this.getInteractiveRatio() * 100}%` | ||
}; | ||
const rows = tail ? this._firstStore.slice(-tail) : this._firstStore; | ||
logger.table(rows); | ||
} | ||
/* | ||
* Start a group | ||
*/ | ||
group(name) { | ||
return new Group(this, name); | ||
} | ||
/* Run a function only when probe is enabled */ | ||
run(func, arg) { | ||
const {isEnabled, isRunEnabled} = this._config; | ||
const isEnabled = this._getOption('isEnabled'); | ||
const isRunEnabled = this._getOption('isRunEnabled'); | ||
if (isEnabled && isRunEnabled) { | ||
func(arg); | ||
} | ||
return this; | ||
} | ||
startIiterations() { | ||
this._iterationsTs = timestamp(); | ||
/* Conditionally run a function only when probe is enabled | ||
* If condition is a string, it will be looked up as an option | ||
*/ | ||
runIf(condition, func, arg) { | ||
if (typeof condition === 'string') { | ||
condition = Boolean(this._getOption(condition)); | ||
} | ||
return condition ? this.run(func, arg) : this; | ||
} | ||
/** | ||
* Get config from persistent store, if available | ||
* @return {Object} config | ||
* Show current log in a table, if supported by console | ||
* @param {Number} tail If supplied, show only the last n entries | ||
* @returns {Probe} - returns itself for chaining | ||
*/ | ||
_getConfigFromEnvironment() { | ||
let customConfig = {}; | ||
if (!IS_NODE) { | ||
const serialized = {}; // cookie.get(COOKIE_NAME); | ||
if (serialized) { | ||
customConfig = JSON.parse(serialized); | ||
} | ||
table(tail) { | ||
const isEnabled = this._getOption('isEnabled'); | ||
if (isEnabled && typeof logger.table === 'function') { | ||
const rows = tail ? this._logStore.slice(-tail) : this._logStore; | ||
logger.table(rows); | ||
} | ||
return Object.assign({}, DEFAULT_CONFIG, customConfig); | ||
return this; | ||
} | ||
// PROFILING | ||
startIiterations() { | ||
this._iterationsTs = getTimestamp(); | ||
return this; | ||
} | ||
/* Count iterations per second. Runs the provided function a | ||
@@ -438,3 +490,3 @@ * specified number of times and normalizes the result to represent | ||
} | ||
const elapsedMillis = timestamp() - this._iterationsTs; | ||
const elapsedMillis = getTimestamp() - this._iterationsTs; | ||
const iterationsPerSecond = formatSI(iterations * 1000 / elapsedMillis); | ||
@@ -454,15 +506,243 @@ return iterationsPerSecond; | ||
logger.log(`${testName}: ${iterationsPerSecond} iterations/s`); | ||
return this; | ||
} | ||
getInteractiveRatio() { | ||
const time = getTimestamp(); | ||
const ratio = this.interactiveHeartbeats * INTERACTIVE_CHECK_TIMEOUT / time; | ||
return ratio.toPrecision(3); | ||
} | ||
// DEPRECATED METHODS | ||
// xprobe functionality is now enabled in default probes | ||
// Returns the bound logging function for application to call | ||
// Experiment to get console source code links to app instead of probe | ||
xprobe(...args) { | ||
const logFunc = this._probe(...args); | ||
return logFunc; | ||
} | ||
// Returns the bound logging function for application to call | ||
// Experiment to get console source code links to app instead of probe | ||
xsample(...args) { | ||
return this._sample(...args); | ||
} | ||
xfps(...args) { | ||
return this._fps(...args); | ||
} | ||
xExternalProbe(...args) { | ||
return this._externalProbe(...args); | ||
} | ||
xfirst(level, name, message = '', meta = {}) { | ||
return this.first(...arguments); | ||
} | ||
// PRIVATE METHODS | ||
_probe(level, name, meta) { | ||
let logFunc = noop; | ||
if (this._shouldLog(level)) { | ||
logFunc = this._log(level, name, meta); | ||
} | ||
return logFunc; | ||
} | ||
_sample(level, name, meta) { | ||
let logFunc = noop; | ||
if (this._shouldLog(level)) { | ||
const samples = this._sampleStore; | ||
const probeData = samples[name] || ( | ||
samples[name] = {timeSum: 0, count: 0, averageTime: 0} | ||
); | ||
probeData.timeSum += getTimestamp() - this._deltaTs; | ||
probeData.count += 1; | ||
probeData.averageTime = probeData.timeSum / probeData.count; | ||
logFunc = this._log(level, name, Object.assign({}, meta, { | ||
averageTime: probeData.averageTime | ||
})); | ||
// Weight more heavily on later samples. Otherwise it gets almost | ||
// impossible to see outliers after a while. | ||
if (probeData.count === 10) { | ||
probeData.count = 5; | ||
probeData.timeSum /= 2; | ||
} | ||
} | ||
return logFunc; | ||
} | ||
_getFpsData(name) { | ||
let fpsData = this._fpsStore[name]; | ||
if (!fpsData) { | ||
fpsData = {totalCount: 0, count: 0, time: getTimestamp()}; | ||
Object.seal(fpsData); | ||
this._fpsStore[name] = fpsData; | ||
} | ||
return fpsData; | ||
} | ||
_fps(level, name = 'default', opts = {}) { | ||
const {count = 10, head = 0} = opts; | ||
let logFunc = noop; | ||
if (this._shouldLog(level)) { | ||
const fpsData = this._getFpsData(name); | ||
++fpsData.totalCount; | ||
++fpsData.count; | ||
// Only log every "count" probes, skipping others | ||
if (fpsData.count >= count) { | ||
const fps = fpsData.count / (getTimestamp() - fpsData.time) * 1000; | ||
fpsData.count = 0; | ||
fpsData.time = getTimestamp(); | ||
logFunc = this._log(level, name, Object.assign({}, opts, {fps})); | ||
// But... always log the first "head" probes | ||
} else if (fpsData.totalCount < head) { | ||
logFunc = this._probe(level, name, opts); | ||
} | ||
} | ||
return logFunc; | ||
} | ||
_externalProbe(level, name, timeStart, timeSpent, meta) { | ||
let logFunc = noop; | ||
if (this._shouldLog(level)) { | ||
// External probes are expected to provide epoch getTimestamps | ||
const total = timeStart - this._startEpochTs; | ||
const delta = timeSpent; | ||
logFunc = this._log(level, name, Object.assign({total, delta}, meta)); | ||
} | ||
return logFunc; | ||
} | ||
_initConfig({ignoreEnvironment = false} = {}) { | ||
// Use default config as base and override it with environment | ||
this._config = Object.assign({}, DEFAULT_CONFIG); | ||
if (!ignoreEnvironment) { | ||
try { | ||
// Protect against an exception when parsing config | ||
const config = this._getConfigFromEnvironment(); | ||
// Walk through the loaded config to make sure it is well formatted | ||
// This ensures that we don't break when loading environments written | ||
// by incompatible versions of probe. | ||
for (const key in config) { | ||
assert('value' in config[key]); | ||
const value = config[key].value; | ||
const doc = config[key].doc || 'N/A'; | ||
assert(typeof doc === 'string'); | ||
this._config[key] = {value, doc}; | ||
} | ||
} catch (error) { | ||
logger.error('Probe failed to read config, resetting environment'); | ||
this._config = Object.assign({}, DEFAULT_CONFIG); | ||
this._updateEnvironment(); | ||
} | ||
} | ||
} | ||
/** | ||
* Show current log in a table, if supported by console | ||
* @param {Number} tail If supplied, show only the last n entries | ||
* Get config from persistent store, if available | ||
* @return {Object} config | ||
*/ | ||
table(tail) { | ||
if (typeof logger.table === 'function') { | ||
const rows = tail ? this._logStore.slice(-tail) : this._logStore; | ||
logger.table(rows); | ||
_getConfigFromEnvironment() { | ||
let customConfig = {}; | ||
if (isBrowser) { | ||
const serialized = this.storage.get(PROBE_STORAGE_KEY_NAME); | ||
if (serialized) { | ||
customConfig = JSON.parse(serialized); | ||
} | ||
} else { | ||
// TODO - get config from Node's command line arguments | ||
} | ||
return Object.assign({}, DEFAULT_CONFIG, customConfig); | ||
} | ||
_updateEnvironment() { | ||
if (isBrowser) { | ||
const serialized = JSON.stringify(this._config); | ||
this.storage.set(PROBE_STORAGE_KEY_NAME, serialized); | ||
} | ||
// Support chaining | ||
return this; | ||
} | ||
_getElapsedTime() { | ||
const total = Number((getTimestamp() - this._startTs).toPrecision(10)); | ||
const delta = Number((getTimestamp() - this._deltaTs).toPrecision(10)); | ||
// reset delta timer | ||
this._deltaTs = getTimestamp(); | ||
return {total, delta}; | ||
} | ||
_shouldLog(probeLevel) { | ||
const isEnabled = this._getOption('isEnabled'); | ||
const isLogEnabled = this._getOption('isLogEnabled'); | ||
const level = this.getLevel(); | ||
return isEnabled && isLogEnabled && level >= probeLevel; | ||
} | ||
_log(level, name, meta = {}) { | ||
const isPrintEnabled = this._getOption('isPrintEnabled'); | ||
const useIndirectLogging = this._getOption('useIndirectLogging'); | ||
const logRow = this._createLogRow({level, name}, meta); | ||
this._logStore.push(logRow); | ||
// Log to console if enabled | ||
let logFunction = noop; | ||
if (isPrintEnabled) { | ||
const line = this._formatLogRowForConsole(logRow); | ||
logFunction = logRow.info ? logger.info : logger.debug; | ||
logFunction = logFunction.bind(logger, line); | ||
} | ||
if (useIndirectLogging) { | ||
logFunction(); | ||
logFunction = noop; | ||
} | ||
return logFunction; | ||
} | ||
_createLogRow(opts) { | ||
const {total, delta} = this._getElapsedTime(); | ||
const logRow = Object.assign({total, delta}, opts); | ||
// duration handling | ||
const {name} = opts; | ||
if (opts.start) { | ||
this._startStore[name] = getTimestamp(); | ||
} else if (opts.end) { | ||
// If start isn't found, take the full duration since initialization | ||
const start = this._startStore[name] || this._startTs; | ||
logRow.duration = getTimestamp() - start; | ||
} | ||
return logRow; | ||
} | ||
// Nicer console logging | ||
_formatLogRowForConsole(logRow) { | ||
const delta = formatTime(logRow.delta); | ||
const total = formatTime(logRow.total); | ||
const fps = logRow.fps ? `FPS ${logRow.fps.toPrecision(2)}` : ''; | ||
const indent = logRow.indent || ''; | ||
return `${indent} ${leftPad(total)} ${leftPad(delta)} ` + | ||
`${logRow.name} ${fps}`; | ||
} | ||
// Calls a timer and counts how many times it fires. | ||
// This is used to calculate percentage of elapsed time that system | ||
// was not loaded. | ||
_startInteractiveHearbeat() { | ||
this.interactiveHeartbeats = 0; | ||
if (isBrowser) { | ||
/* global setInterval */ | ||
setInterval(() => { | ||
this.interactiveHeartbeats++; | ||
}, INTERACTIVE_CHECK_TIMEOUT); | ||
} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
477903
43
5572
25
2
1
+ Addedbabel-runtime@^6.11.6
+ Addedd3-format@^1.2.0
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addedd3-format@1.4.5(transitive)
+ Addedregenerator-runtime@0.11.1(transitive)