function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { LogConfig, Logger } from "../../util/logger";
import { getDebugContext } from "./debugger";
export var ConsoleLogger = /*#__PURE__*/function () {
  function ConsoleLogger(options) {
    _classCallCheck(this, ConsoleLogger);
    _defineProperty(this, "show", false);
    this.show = options === null || options === void 0 ? void 0 : options.show;
  }
  _createClass(ConsoleLogger, [{
    key: "log",
    value: function log(message) {
      var _console;
      if (!this.show) return;
      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
      }
      (_console = console).log.apply(_console, ["[sdk-loader] ".concat(message)].concat(args));
    }
  }, {
    key: "warn",
    value: function warn(message) {
      var _console2;
      if (!this.show) return;
      for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
        args[_key2 - 1] = arguments[_key2];
      }
      (_console2 = console).warn.apply(_console2, ["[sdk-loader] ".concat(message)].concat(args));
    }
  }, {
    key: "error",
    value: function error(message) {
      var _console3;
      if (!this.show) return;
      for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
        args[_key3 - 1] = arguments[_key3];
      }
      (_console3 = console).error.apply(_console3, ["[sdk-loader] ".concat(message)].concat(args));
    }
  }]);
  return ConsoleLogger;
}();

// consoleLogger仅用于控制台打印
var _getDebugContext = getDebugContext(),
  debugMode = _getDebugContext.debugMode,
  showLogger = _getDebugContext.showLogger;
export var consoleLogger = new ConsoleLogger({
  show: debugMode ? showLogger : false
});

// SPM日志上报用logger 先全部收口到这里,后续loader单独拆包后进行解耦
export var logger = new Logger(LogConfig, true);