backendless 7.0.0 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * ********************************************************************************************************************
3
- * Backendless SDK for JavaScript. Version: 7.0.0
3
+ * Backendless SDK for JavaScript. Version: 7.0.2
4
4
  *
5
5
  * Copyright 2012-2023 BACKENDLESS.COM. All Rights Reserved.
6
6
  *
@@ -7040,17 +7040,25 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/r
7040
7040
  var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
7041
7041
  var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
7042
7042
  var _logger = _interopRequireDefault(__webpack_require__(/*! ./logger */ "./src/logging/logger.js"));
7043
+ var GLOBAL_LOGGER_NAME = 'Global logger';
7043
7044
  var Logging = /*#__PURE__*/function () {
7044
7045
  function Logging(app) {
7045
7046
  (0, _classCallCheck2["default"])(this, Logging);
7046
7047
  this.app = app;
7047
7048
  this.reset();
7048
- this.setConfig(app.loggingConfig);
7049
+ if (app.loggingConfig) {
7050
+ this.setConfig(app.loggingConfig);
7051
+ }
7049
7052
  }
7050
7053
  (0, _createClass2["default"])(Logging, [{
7051
7054
  key: "setConfig",
7052
7055
  value: function setConfig(config) {
7053
- this.config = config;
7056
+ if (config.levels) {
7057
+ this.levels = config.levels;
7058
+ }
7059
+ if (config.defaultLevel) {
7060
+ this.defaultLevel = config.defaultLevel;
7061
+ }
7054
7062
  if (config.loadLevels) {
7055
7063
  this.loadLoggingLevels();
7056
7064
  }
@@ -7058,6 +7066,8 @@ var Logging = /*#__PURE__*/function () {
7058
7066
  }, {
7059
7067
  key: "reset",
7060
7068
  value: function reset() {
7069
+ this.levels = {};
7070
+ this.defaultLevel = 'all';
7061
7071
  this.loggers = {};
7062
7072
  this.messages = [];
7063
7073
  this.numOfMessages = 10;
@@ -7072,8 +7082,9 @@ var Logging = /*#__PURE__*/function () {
7072
7082
  url: this.app.urls.loggingLevels()
7073
7083
  }).then(function (loggers) {
7074
7084
  loggers.forEach(function (logger) {
7075
- _this.config.levels[logger.name] = logger.level;
7085
+ _this.levels[logger.name] = logger.level;
7076
7086
  });
7087
+ _this.defaultLevel = _this.levels[GLOBAL_LOGGER_NAME] || _this.defaultLevel;
7077
7088
  })["catch"](function (error) {
7078
7089
  // eslint-disable-next-line no-console
7079
7090
  console.error('Could not load logging levels: ', error);
@@ -7272,11 +7283,7 @@ var Logger = /*#__PURE__*/function () {
7272
7283
  }, {
7273
7284
  key: "min",
7274
7285
  value: function min(level) {
7275
- var configuredLevel = this.logging.config.levels[this.name];
7276
- if (!configuredLevel) {
7277
- var defaultLevel = this.logging.config.defaultLevel;
7278
- return LogLevelPriorities[defaultLevel.toLowerCase()] >= LogLevelPriorities[level.toLowerCase()];
7279
- }
7286
+ var configuredLevel = this.logging.levels[this.name] || this.logging.defaultLevel;
7280
7287
  return LogLevelPriorities[configuredLevel.toLowerCase()] >= LogLevelPriorities[level.toLowerCase()];
7281
7288
  }
7282
7289
  }]);