Sha256: 13f371fb74f8c0900fe3848d318af3510be4d54d6101f56f356975f5d134065f

Contents?: true

Size: 1.81 KB

Versions: 32

Compression:

Stored size: 1.81 KB

Contents

"use strict";

exports.__esModule = true;

var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _node = require("debug/node");

var _node2 = _interopRequireDefault(_node);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var verboseDebug = (0, _node2.default)("babel:verbose");
var generalDebug = (0, _node2.default)("babel");

var seenDeprecatedMessages = [];

var Logger = function () {
  function Logger(file, filename) {
    (0, _classCallCheck3.default)(this, Logger);

    this.filename = filename;
    this.file = file;
  }

  Logger.prototype._buildMessage = function _buildMessage(msg) {
    var parts = "[BABEL] " + this.filename;
    if (msg) parts += ": " + msg;
    return parts;
  };

  Logger.prototype.warn = function warn(msg) {
    console.warn(this._buildMessage(msg));
  };

  Logger.prototype.error = function error(msg) {
    var Constructor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Error;

    throw new Constructor(this._buildMessage(msg));
  };

  Logger.prototype.deprecate = function deprecate(msg) {
    if (this.file.opts && this.file.opts.suppressDeprecationMessages) return;

    msg = this._buildMessage(msg);

    if (seenDeprecatedMessages.indexOf(msg) >= 0) return;

    seenDeprecatedMessages.push(msg);

    console.error(msg);
  };

  Logger.prototype.verbose = function verbose(msg) {
    if (verboseDebug.enabled) verboseDebug(this._buildMessage(msg));
  };

  Logger.prototype.debug = function debug(msg) {
    if (generalDebug.enabled) generalDebug(this._buildMessage(msg));
  };

  Logger.prototype.deopt = function deopt(node, msg) {
    this.debug(msg);
  };

  return Logger;
}();

exports.default = Logger;
module.exports = exports["default"];

Version data entries

32 entries across 28 versions & 9 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.50 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.49 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.48 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.47 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.46 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.45 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.44 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.43 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.42 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.41 node_modules/babel-core/lib/transformation/file/logger.js
immosquare-cleaner-0.1.40 node_modules/babel-core/lib/transformation/file/logger.js
ilog-0.4.1 node_modules/babel-core/lib/transformation/file/logger.js
ilog-0.4.0 node_modules/babel-core/lib/transformation/file/logger.js
ilog-0.3.3 node_modules/babel-core/lib/transformation/file/logger.js
optimacms-0.4.3 spec/dummy/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/logger.js
optimacms-0.4.3 spec/dummy/node_modules/babel-core/lib/transformation/file/logger.js
optimacms-0.4.3 spec/dummy/node_modules/@rails/webpacker/node_modules/babel-core/lib/transformation/file/logger.js
optimacms-0.4.2 spec/dummy/node_modules/@rails/webpacker/node_modules/babel-core/lib/transformation/file/logger.js
optimacms-0.4.2 spec/dummy/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/logger.js