BVB Source Codes

reactide Show logger.js Source code

Return Download reactide: download logger.js Source code - Download reactide Source code - Type:.js
  1. "use strict";
  2.  
  3. exports.__esModule = true;
  4.  
  5. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  6.  
  7. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  8.  
  9. var _node = require("debug/node");
  10.  
  11. var _node2 = _interopRequireDefault(_node);
  12.  
  13. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14.  
  15. var verboseDebug = (0, _node2.default)("babel:verbose");
  16. var generalDebug = (0, _node2.default)("babel");
  17.  
  18. var seenDeprecatedMessages = [];
  19.  
  20. var Logger = function () {
  21.   function Logger(file, filename) {
  22.     (0, _classCallCheck3.default)(this, Logger);
  23.  
  24.     this.filename = filename;
  25.     this.file = file;
  26.   }
  27.  
  28.   Logger.prototype._buildMessage = function _buildMessage(msg) {
  29.     var parts = "[BABEL] " + this.filename;
  30.     if (msg) parts += ": " + msg;
  31.     return parts;
  32.   };
  33.  
  34.   Logger.prototype.warn = function warn(msg) {
  35.     console.warn(this._buildMessage(msg));
  36.   };
  37.  
  38.   Logger.prototype.error = function error(msg) {
  39.     var Constructor = arguments.length <= 1 || arguments[1] === undefined ? Error : arguments[1];
  40.  
  41.     throw new Constructor(this._buildMessage(msg));
  42.   };
  43.  
  44.   Logger.prototype.deprecate = function deprecate(msg) {
  45.     if (this.file.opts && this.file.opts.suppressDeprecationMessages) return;
  46.  
  47.     msg = this._buildMessage(msg);
  48.  
  49.     // already seen this message
  50.     if (seenDeprecatedMessages.indexOf(msg) >= 0) return;
  51.  
  52.     // make sure we don't see it again
  53.     seenDeprecatedMessages.push(msg);
  54.  
  55.     console.error(msg);
  56.   };
  57.  
  58.   Logger.prototype.verbose = function verbose(msg) {
  59.     if (verboseDebug.enabled) verboseDebug(this._buildMessage(msg));
  60.   };
  61.  
  62.   Logger.prototype.debug = function debug(msg) {
  63.     if (generalDebug.enabled) generalDebug(this._buildMessage(msg));
  64.   };
  65.  
  66.   Logger.prototype.deopt = function deopt(node, msg) {
  67.     this.debug(msg);
  68.   };
  69.  
  70.   return Logger;
  71. }();
  72.  
  73. exports.default = Logger;
  74. module.exports = exports["default"];
downloadlogger.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top