backendless 6.6.4 → 6.6.5
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/backendless.d.ts +2 -0
- package/dist/backendless.js +38 -9
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/logging/index.js +37 -8
- package/lib/logging/index.js +37 -8
- package/package.json +1 -1
- package/src/logging/index.js +34 -9
package/backendless.d.ts
CHANGED
package/dist/backendless.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ********************************************************************************************************************
|
|
3
|
-
* Backendless SDK for JavaScript. Version: 6.6.
|
|
3
|
+
* Backendless SDK for JavaScript. Version: 6.6.5
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2012-2023 BACKENDLESS.COM. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -21023,6 +21023,8 @@ exports["default"] = void 0;
|
|
|
21023
21023
|
|
|
21024
21024
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
21025
21025
|
|
|
21026
|
+
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
|
|
21027
|
+
|
|
21026
21028
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
21027
21029
|
|
|
21028
21030
|
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
@@ -21042,9 +21044,10 @@ var Logging = /*#__PURE__*/function () {
|
|
|
21042
21044
|
key: "reset",
|
|
21043
21045
|
value: function reset() {
|
|
21044
21046
|
this.loggers = {};
|
|
21045
|
-
this.
|
|
21047
|
+
this.messages = [];
|
|
21046
21048
|
this.numOfMessages = 10;
|
|
21047
21049
|
this.timeFrequency = 1;
|
|
21050
|
+
this.messagesLimit = 100;
|
|
21048
21051
|
}
|
|
21049
21052
|
}, {
|
|
21050
21053
|
key: "getLogger",
|
|
@@ -21065,19 +21068,27 @@ var Logging = /*#__PURE__*/function () {
|
|
|
21065
21068
|
var _flush = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
21066
21069
|
var _this = this;
|
|
21067
21070
|
|
|
21071
|
+
var messages;
|
|
21068
21072
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
21069
21073
|
while (1) {
|
|
21070
21074
|
switch (_context.prev = _context.next) {
|
|
21071
21075
|
case 0:
|
|
21072
|
-
if (!this.flushRequest && this.
|
|
21076
|
+
if (!this.flushRequest && this.messages.length) {
|
|
21073
21077
|
this.stopFlushInterval();
|
|
21078
|
+
messages = (0, _toConsumableArray2["default"])(this.messages);
|
|
21079
|
+
this.messages = [];
|
|
21074
21080
|
this.flushRequest = this.app.request.put({
|
|
21075
21081
|
url: this.app.urls.logging(),
|
|
21076
|
-
data:
|
|
21077
|
-
})
|
|
21078
|
-
|
|
21082
|
+
data: messages
|
|
21083
|
+
})["catch"](function (error) {
|
|
21084
|
+
_this.messages = [].concat((0, _toConsumableArray2["default"])(messages), (0, _toConsumableArray2["default"])(_this.messages));
|
|
21085
|
+
|
|
21086
|
+
_this.checkMessagesLimit();
|
|
21087
|
+
|
|
21088
|
+
throw error;
|
|
21089
|
+
})["finally"](function () {
|
|
21090
|
+
return delete _this.flushRequest;
|
|
21079
21091
|
});
|
|
21080
|
-
this.pool = [];
|
|
21081
21092
|
}
|
|
21082
21093
|
|
|
21083
21094
|
return _context.abrupt("return", this.flushRequest);
|
|
@@ -21103,22 +21114,30 @@ var Logging = /*#__PURE__*/function () {
|
|
|
21103
21114
|
throw new Error('"message" must be a string');
|
|
21104
21115
|
}
|
|
21105
21116
|
|
|
21106
|
-
this.
|
|
21117
|
+
this.messages.push({
|
|
21107
21118
|
logger: logger,
|
|
21108
21119
|
message: message,
|
|
21109
21120
|
exception: exception,
|
|
21110
21121
|
'log-level': logLevel,
|
|
21111
21122
|
timestamp: Date.now()
|
|
21112
21123
|
});
|
|
21124
|
+
this.checkMessagesLimit();
|
|
21113
21125
|
this.checkMessagesLen();
|
|
21114
21126
|
}
|
|
21115
21127
|
}, {
|
|
21116
21128
|
key: "checkMessagesLen",
|
|
21117
21129
|
value: function checkMessagesLen() {
|
|
21118
|
-
if (this.
|
|
21130
|
+
if (this.messages.length >= this.numOfMessages) {
|
|
21119
21131
|
this.startFlushInterval();
|
|
21120
21132
|
}
|
|
21121
21133
|
}
|
|
21134
|
+
}, {
|
|
21135
|
+
key: "checkMessagesLimit",
|
|
21136
|
+
value: function checkMessagesLimit() {
|
|
21137
|
+
if (this.messages.length > this.messagesLimit) {
|
|
21138
|
+
this.messages = this.messages.slice(this.messages.length - this.messagesLimit);
|
|
21139
|
+
}
|
|
21140
|
+
}
|
|
21122
21141
|
}, {
|
|
21123
21142
|
key: "startFlushInterval",
|
|
21124
21143
|
value: function startFlushInterval() {
|
|
@@ -21145,10 +21164,20 @@ var Logging = /*#__PURE__*/function () {
|
|
|
21145
21164
|
this.stopFlushInterval();
|
|
21146
21165
|
}
|
|
21147
21166
|
|
|
21167
|
+
if (numOfMessages > this.messagesLimit) {
|
|
21168
|
+
this.messagesLimit = numOfMessages;
|
|
21169
|
+
}
|
|
21170
|
+
|
|
21148
21171
|
this.numOfMessages = numOfMessages;
|
|
21149
21172
|
this.timeFrequency = timeFrequency;
|
|
21150
21173
|
this.checkMessagesLen();
|
|
21151
21174
|
}
|
|
21175
|
+
}, {
|
|
21176
|
+
key: "setMessagesLimit",
|
|
21177
|
+
value: function setMessagesLimit(messagesLimit) {
|
|
21178
|
+
this.messagesLimit = messagesLimit;
|
|
21179
|
+
this.checkMessagesLimit();
|
|
21180
|
+
}
|
|
21152
21181
|
}]);
|
|
21153
21182
|
return Logging;
|
|
21154
21183
|
}();
|