text: var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  var consoleLogger = {
    type: 'logger',
  
    log: function log(args) {
      this._output('log', args);
    },
    warn: function warn(args) {
      this._output('warn', args);
    },
    error: function error(args) {
      this._output('error', args);
    },
    _output: function _output(type, args) {
      if (console && console[type]) console[type].apply(console, Array.prototype.slice.call(args));
    }
  };
  
  var Logger = function () {
    function Logger(concreteLogger) {
      var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  
      _classCallCheck(this, Logger);
  
      this.subs = [];
      this.init(concreteLogger, options);
    }
  
    Logger.prototype.init = function init(concreteLogger) {
      var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  
      this.prefix = options.prefix || 'i18next:';
      this.logger = concreteLogger || consoleLogger;
      this.options = options;
      this.debug = options.debug === false ? false : true;
    };
  
    Logger.prototype.setDebug = function setDebug(bool) {
      this.debug = bool;
      this.subs.forEach(function (sub) {
        sub.setDebug(bool);
      });
    };
  
    Logger.prototype.log = function log() {
      this.forward(arguments, 'log', '', true);
    };
  
    Logger.prototype.warn = function warn() {
      this.forward(arguments, 'warn', '', true);
    };
  
    Logger.prototype.error = function error() {
      this.forward(arguments, 'error', '');
    };
  
    Logger.prototype.deprecate = function deprecate() {
      this.forward(arguments, 'warn', 'WARNING DEPRECATED: ', true);
    };
  
    Logger.prototype.forward = function forward(args, lvl, prefix, debugOnly) {
      if (debugOnly && !this.debug) return;
      if (typeof args[0] === 'string') args[0] = prefix + this.prefix + ' ' + args[0];
      this.logger[lvl](args);
    };
  
    Logger.prototype.create = function create(moduleName) {
      var sub = new Logger(this.logger, _extends({ prefix: this.prefix + ':' + moduleName + ':' }, this.options));
      this.subs.push(sub);
  
      return sub;
    };
  
    // createInstance(options = {}) {
    //   return new Logger(options, callback);
    // }
  
    return Logger;
  }();
  
  ;
  
  export default new Logger();