backendless 6.7.1-dev.2 → 7.0.0
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.
- package/dist/backendless.js +77 -13
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/index.js +8 -0
- package/es/logging/index.js +30 -6
- package/es/logging/logger.js +33 -6
- package/es/urls.js +5 -0
- package/lib/index.js +8 -0
- package/lib/logging/index.js +30 -6
- package/lib/logging/logger.js +33 -6
- package/lib/urls.js +5 -0
- package/package.json +1 -1
- package/src/index.js +5 -0
- package/src/logging/index.js +24 -0
- package/src/logging/logger.js +35 -6
- package/src/urls.js +4 -0
package/dist/backendless.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ********************************************************************************************************************
|
|
3
|
-
* Backendless SDK for JavaScript. Version:
|
|
3
|
+
* Backendless SDK for JavaScript. Version: 7.0.0
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2012-2023 BACKENDLESS.COM. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -6279,6 +6279,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6279
6279
|
value: true
|
|
6280
6280
|
}));
|
|
6281
6281
|
exports["default"] = void 0;
|
|
6282
|
+
var _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/extends.js"));
|
|
6282
6283
|
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
6283
6284
|
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
6284
6285
|
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
@@ -6434,13 +6435,20 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
6434
6435
|
app.initConfig(config);
|
|
6435
6436
|
app.resetRT();
|
|
6436
6437
|
app.__removeService('LocalCache');
|
|
6438
|
+
var loggingConfig = (0, _extends2["default"])({
|
|
6439
|
+
loadLevels: true,
|
|
6440
|
+
defaultLevel: 'all',
|
|
6441
|
+
levels: {}
|
|
6442
|
+
}, config.logging);
|
|
6437
6443
|
if (app.__hasService('Logging')) {
|
|
6438
6444
|
app.Logging.reset();
|
|
6445
|
+
app.Logging.setConfig(loggingConfig);
|
|
6439
6446
|
}
|
|
6440
6447
|
if (app.__hasService('Users')) {
|
|
6441
6448
|
app.Users.currentUser = null;
|
|
6442
6449
|
}
|
|
6443
6450
|
delete this.__device;
|
|
6451
|
+
app.loggingConfig = loggingConfig;
|
|
6444
6452
|
return app;
|
|
6445
6453
|
}
|
|
6446
6454
|
}, {
|
|
@@ -7037,8 +7045,17 @@ var Logging = /*#__PURE__*/function () {
|
|
|
7037
7045
|
(0, _classCallCheck2["default"])(this, Logging);
|
|
7038
7046
|
this.app = app;
|
|
7039
7047
|
this.reset();
|
|
7048
|
+
this.setConfig(app.loggingConfig);
|
|
7040
7049
|
}
|
|
7041
7050
|
(0, _createClass2["default"])(Logging, [{
|
|
7051
|
+
key: "setConfig",
|
|
7052
|
+
value: function setConfig(config) {
|
|
7053
|
+
this.config = config;
|
|
7054
|
+
if (config.loadLevels) {
|
|
7055
|
+
this.loadLoggingLevels();
|
|
7056
|
+
}
|
|
7057
|
+
}
|
|
7058
|
+
}, {
|
|
7042
7059
|
key: "reset",
|
|
7043
7060
|
value: function reset() {
|
|
7044
7061
|
this.loggers = {};
|
|
@@ -7047,6 +7064,21 @@ var Logging = /*#__PURE__*/function () {
|
|
|
7047
7064
|
this.timeFrequency = 1;
|
|
7048
7065
|
this.messagesLimit = 100;
|
|
7049
7066
|
}
|
|
7067
|
+
}, {
|
|
7068
|
+
key: "loadLoggingLevels",
|
|
7069
|
+
value: function loadLoggingLevels() {
|
|
7070
|
+
var _this = this;
|
|
7071
|
+
this.app.request.get({
|
|
7072
|
+
url: this.app.urls.loggingLevels()
|
|
7073
|
+
}).then(function (loggers) {
|
|
7074
|
+
loggers.forEach(function (logger) {
|
|
7075
|
+
_this.config.levels[logger.name] = logger.level;
|
|
7076
|
+
});
|
|
7077
|
+
})["catch"](function (error) {
|
|
7078
|
+
// eslint-disable-next-line no-console
|
|
7079
|
+
console.error('Could not load logging levels: ', error);
|
|
7080
|
+
});
|
|
7081
|
+
}
|
|
7050
7082
|
}, {
|
|
7051
7083
|
key: "getLogger",
|
|
7052
7084
|
value: function getLogger(loggerName) {
|
|
@@ -7062,7 +7094,7 @@ var Logging = /*#__PURE__*/function () {
|
|
|
7062
7094
|
key: "flush",
|
|
7063
7095
|
value: function () {
|
|
7064
7096
|
var _flush = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
7065
|
-
var
|
|
7097
|
+
var _this2 = this;
|
|
7066
7098
|
var messages;
|
|
7067
7099
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
7068
7100
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -7075,11 +7107,11 @@ var Logging = /*#__PURE__*/function () {
|
|
|
7075
7107
|
url: this.app.urls.logging(),
|
|
7076
7108
|
data: messages
|
|
7077
7109
|
})["catch"](function (error) {
|
|
7078
|
-
|
|
7079
|
-
|
|
7110
|
+
_this2.messages = [].concat((0, _toConsumableArray2["default"])(messages), (0, _toConsumableArray2["default"])(_this2.messages));
|
|
7111
|
+
_this2.checkMessagesLimit();
|
|
7080
7112
|
throw error;
|
|
7081
7113
|
})["finally"](function () {
|
|
7082
|
-
return delete
|
|
7114
|
+
return delete _this2.flushRequest;
|
|
7083
7115
|
});
|
|
7084
7116
|
}
|
|
7085
7117
|
return _context.abrupt("return", this.flushRequest);
|
|
@@ -7127,10 +7159,10 @@ var Logging = /*#__PURE__*/function () {
|
|
|
7127
7159
|
}, {
|
|
7128
7160
|
key: "startFlushInterval",
|
|
7129
7161
|
value: function startFlushInterval() {
|
|
7130
|
-
var
|
|
7162
|
+
var _this3 = this;
|
|
7131
7163
|
if (!this.flushInterval) {
|
|
7132
7164
|
this.flushInterval = setTimeout(function () {
|
|
7133
|
-
return
|
|
7165
|
+
return _this3.flush();
|
|
7134
7166
|
}, this.timeFrequency * 1000);
|
|
7135
7167
|
}
|
|
7136
7168
|
}
|
|
@@ -7184,6 +7216,16 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7184
7216
|
exports["default"] = void 0;
|
|
7185
7217
|
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
7186
7218
|
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
7219
|
+
var LogLevelPriorities = {
|
|
7220
|
+
off: 0,
|
|
7221
|
+
fatal: 1,
|
|
7222
|
+
error: 2,
|
|
7223
|
+
warn: 3,
|
|
7224
|
+
info: 4,
|
|
7225
|
+
debug: 5,
|
|
7226
|
+
trace: 6,
|
|
7227
|
+
all: 6
|
|
7228
|
+
};
|
|
7187
7229
|
var Logger = /*#__PURE__*/function () {
|
|
7188
7230
|
function Logger(name, logging) {
|
|
7189
7231
|
(0, _classCallCheck2["default"])(this, Logger);
|
|
@@ -7193,32 +7235,49 @@ var Logger = /*#__PURE__*/function () {
|
|
|
7193
7235
|
(0, _createClass2["default"])(Logger, [{
|
|
7194
7236
|
key: "debug",
|
|
7195
7237
|
value: function debug(message) {
|
|
7196
|
-
return this.
|
|
7238
|
+
return this.log('DEBUG', message);
|
|
7197
7239
|
}
|
|
7198
7240
|
}, {
|
|
7199
7241
|
key: "info",
|
|
7200
7242
|
value: function info(message) {
|
|
7201
|
-
return this.
|
|
7243
|
+
return this.log('INFO', message);
|
|
7202
7244
|
}
|
|
7203
7245
|
}, {
|
|
7204
7246
|
key: "warn",
|
|
7205
7247
|
value: function warn(message, exception) {
|
|
7206
|
-
return this.
|
|
7248
|
+
return this.log('WARN', message, exception);
|
|
7207
7249
|
}
|
|
7208
7250
|
}, {
|
|
7209
7251
|
key: "error",
|
|
7210
7252
|
value: function error(message, exception) {
|
|
7211
|
-
return this.
|
|
7253
|
+
return this.log('ERROR', message, exception);
|
|
7212
7254
|
}
|
|
7213
7255
|
}, {
|
|
7214
7256
|
key: "fatal",
|
|
7215
7257
|
value: function fatal(message, exception) {
|
|
7216
|
-
return this.
|
|
7258
|
+
return this.log('FATAL', message, exception);
|
|
7217
7259
|
}
|
|
7218
7260
|
}, {
|
|
7219
7261
|
key: "trace",
|
|
7220
7262
|
value: function trace(message) {
|
|
7221
|
-
return this.
|
|
7263
|
+
return this.log('TRACE', message);
|
|
7264
|
+
}
|
|
7265
|
+
}, {
|
|
7266
|
+
key: "log",
|
|
7267
|
+
value: function log(level, message, exception) {
|
|
7268
|
+
if (this.min(level)) {
|
|
7269
|
+
return this.logging.push(this.name, level, message, exception);
|
|
7270
|
+
}
|
|
7271
|
+
}
|
|
7272
|
+
}, {
|
|
7273
|
+
key: "min",
|
|
7274
|
+
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
|
+
}
|
|
7280
|
+
return LogLevelPriorities[configuredLevel.toLowerCase()] >= LogLevelPriorities[level.toLowerCase()];
|
|
7222
7281
|
}
|
|
7223
7282
|
}]);
|
|
7224
7283
|
return Logger;
|
|
@@ -10011,6 +10070,11 @@ var Urls = /*#__PURE__*/function () {
|
|
|
10011
10070
|
value: function logging() {
|
|
10012
10071
|
return "".concat(this.root(), "/log");
|
|
10013
10072
|
}
|
|
10073
|
+
}, {
|
|
10074
|
+
key: "loggingLevels",
|
|
10075
|
+
value: function loggingLevels() {
|
|
10076
|
+
return "".concat(this.logging(), "/logger");
|
|
10077
|
+
}
|
|
10014
10078
|
|
|
10015
10079
|
//cache
|
|
10016
10080
|
}, {
|