Skip to content
Snippets Groups Projects
Select Git revision
  • 87c5f9d0c36c973fea5d38fc8a3f6634a1fc2d38
  • test default protected
  • master protected
  • original
  • pirati-backup protected
  • beta-2
  • beta-1
  • v3.1.4
  • v3.1.3
  • v3.1.2
  • v3.1.1
  • v3.1.0
  • v3.0.16
  • v3.0.15
  • v3.0.14
  • v3.0.13
  • v3.0.12
  • v3.0.11
  • v3.0.10
  • v3.0.9
  • v3.0.8
  • v3.0.7
  • v3.0.6
  • v3.0.5
  • v3.0.4
25 results

view_utils.py

Blame
  • logger.js 1.55 KiB
    (function () {
      function Logger(ysy) {
        this.logLevel = 2;
        this.mainDebug = "";
        this.debugTypes = [
          // "keys",
          // "diff",
          // "send",
          // "storage",
          // "events",
          // "changedEvent",
          // "redraw",
          // "history",
          // "validator",
          // "multisave",
          // "autosave",
          // "mm:drag",
          "nothing"
        ];
      }
    
      Logger.prototype.log = function (text) {
        if (this.logLevel >= 4) {
          this.print(text);
        }
      };
      Logger.prototype.message = function (text) {
        if (this.logLevel >= 3) {
          this.print(text);
        }
      };
      Logger.prototype.debug = function (text, type) {
        if (type) {
          if (this.mainDebug === type) {
            this.print(text, "debug");
            return;
          }
          for (var i = 0; i < this.debugTypes.length; i++) {
            if (this.debugTypes[i] === type) {
              this.print(text, type === this.mainDebug ? "debug" : null);
              return;
            }
          }
        } else {
          this.print(text, "debug");
        }
      };
      Logger.prototype.warning = function (text) {
        if (this.logLevel >= 2) {
          this.print(text, "warning");
        }
      };
      Logger.prototype.error = function (text) {
        if (this.logLevel >= 1) {
          this.print(text, "error");
        }
      };
      Logger.prototype.print = function (text, type) {
        if (type === "error") {
          console.error(text);
        } else if (type === "warning") {
          console.warn(text);
        } else if (type === "debug") {
          console.debug(text);
        } else {
          console.log(text);
        }
      };
      easyMindMupClasses.Logger = Logger;
    })();