@aws-amplify/core 4.3.15-cloud-logging.9 → 4.3.15-unstable.10
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/aws-amplify-core.js +102 -246
- package/dist/aws-amplify-core.js.map +1 -1
- package/dist/aws-amplify-core.min.js +6 -6
- package/dist/aws-amplify-core.min.js.map +1 -1
- package/lib/Logger/ConsoleLogger.d.ts +0 -6
- package/lib/Logger/ConsoleLogger.js +43 -118
- package/lib/Logger/ConsoleLogger.js.map +1 -1
- package/lib/Providers/AWSCloudWatchProvider.d.ts +3 -10
- package/lib/Providers/AWSCloudWatchProvider.js +36 -62
- package/lib/Providers/AWSCloudWatchProvider.js.map +1 -1
- package/lib/Util/Constants.d.ts +1 -3
- package/lib/Util/Constants.js +0 -5
- package/lib/Util/Constants.js.map +1 -1
- package/lib/types/types.d.ts +0 -13
- package/lib-esm/Logger/ConsoleLogger.d.ts +0 -6
- package/lib-esm/Logger/ConsoleLogger.js +43 -118
- package/lib-esm/Logger/ConsoleLogger.js.map +1 -1
- package/lib-esm/Providers/AWSCloudWatchProvider.d.ts +3 -10
- package/lib-esm/Providers/AWSCloudWatchProvider.js +36 -62
- package/lib-esm/Providers/AWSCloudWatchProvider.js.map +1 -1
- package/lib-esm/Util/Constants.d.ts +1 -3
- package/lib-esm/Util/Constants.js +1 -4
- package/lib-esm/Util/Constants.js.map +1 -1
- package/lib-esm/types/types.d.ts +0 -13
- package/package.json +2 -3
- package/src/Logger/ConsoleLogger.ts +34 -119
- package/src/Providers/AWSCloudWatchProvider.ts +15 -62
- package/src/Util/Constants.ts +0 -7
- package/src/types/types.ts +62 -79
- package/lib/Providers/AmazonKinesisLoggingProvider.d.ts +0 -13
- package/lib/Providers/AmazonKinesisLoggingProvider.js +0 -30
- package/lib/Providers/AmazonKinesisLoggingProvider.js.map +0 -1
- package/lib-esm/Providers/AmazonKinesisLoggingProvider.d.ts +0 -13
- package/lib-esm/Providers/AmazonKinesisLoggingProvider.js +0 -28
- package/lib-esm/Providers/AmazonKinesisLoggingProvider.js.map +0 -1
- package/src/Providers/AmazonKinesisLoggingProvider.ts +0 -43
package/dist/aws-amplify-core.js
CHANGED
|
@@ -25979,24 +25979,6 @@ function tryDecode(str, decode) {
|
|
|
25979
25979
|
}
|
|
25980
25980
|
|
|
25981
25981
|
|
|
25982
|
-
/***/ }),
|
|
25983
|
-
|
|
25984
|
-
/***/ "../../node_modules/fast-text-encoding/text.min.js":
|
|
25985
|
-
/*!********************************************************************!*\
|
|
25986
|
-
!*** /root/amplify-js/node_modules/fast-text-encoding/text.min.js ***!
|
|
25987
|
-
\********************************************************************/
|
|
25988
|
-
/*! no static exports found */
|
|
25989
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
25990
|
-
|
|
25991
|
-
/* WEBPACK VAR INJECTION */(function(global, Buffer) {(function(l){function m(){}function k(a,c){a=void 0===a?"utf-8":a;c=void 0===c?{fatal:!1}:c;if(-1===r.indexOf(a.toLowerCase()))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+a+"') is invalid.");if(c.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.");}function t(a){return Buffer.from(a.buffer,a.byteOffset,a.byteLength).toString("utf-8")}function u(a){var c=URL.createObjectURL(new Blob([a],{type:"text/plain;charset=UTF-8"}));
|
|
25992
|
-
try{var f=new XMLHttpRequest;f.open("GET",c,!1);f.send();return f.responseText}catch(e){return q(a)}finally{URL.revokeObjectURL(c)}}function q(a){for(var c=0,f=Math.min(65536,a.length+1),e=new Uint16Array(f),h=[],d=0;;){var b=c<a.length;if(!b||d>=f-1){h.push(String.fromCharCode.apply(null,e.subarray(0,d)));if(!b)return h.join("");a=a.subarray(c);d=c=0}b=a[c++];if(0===(b&128))e[d++]=b;else if(192===(b&224)){var g=a[c++]&63;e[d++]=(b&31)<<6|g}else if(224===(b&240)){g=a[c++]&63;var n=a[c++]&63;e[d++]=
|
|
25993
|
-
(b&31)<<12|g<<6|n}else if(240===(b&248)){g=a[c++]&63;n=a[c++]&63;var v=a[c++]&63;b=(b&7)<<18|g<<12|n<<6|v;65535<b&&(b-=65536,e[d++]=b>>>10&1023|55296,b=56320|b&1023);e[d++]=b}}}if(l.TextEncoder&&l.TextDecoder)return!1;var r=["utf-8","utf8","unicode-1-1-utf-8"];Object.defineProperty(m.prototype,"encoding",{value:"utf-8"});m.prototype.encode=function(a,c){c=void 0===c?{stream:!1}:c;if(c.stream)throw Error("Failed to encode: the 'stream' option is unsupported.");c=0;for(var f=a.length,e=0,h=Math.max(32,
|
|
25994
|
-
f+(f>>>1)+7),d=new Uint8Array(h>>>3<<3);c<f;){var b=a.charCodeAt(c++);if(55296<=b&&56319>=b){if(c<f){var g=a.charCodeAt(c);56320===(g&64512)&&(++c,b=((b&1023)<<10)+(g&1023)+65536)}if(55296<=b&&56319>=b)continue}e+4>d.length&&(h+=8,h*=1+c/a.length*2,h=h>>>3<<3,g=new Uint8Array(h),g.set(d),d=g);if(0===(b&4294967168))d[e++]=b;else{if(0===(b&4294965248))d[e++]=b>>>6&31|192;else if(0===(b&4294901760))d[e++]=b>>>12&15|224,d[e++]=b>>>6&63|128;else if(0===(b&4292870144))d[e++]=b>>>18&7|240,d[e++]=b>>>12&
|
|
25995
|
-
63|128,d[e++]=b>>>6&63|128;else continue;d[e++]=b&63|128}}return d.slice?d.slice(0,e):d.subarray(0,e)};Object.defineProperty(k.prototype,"encoding",{value:"utf-8"});Object.defineProperty(k.prototype,"fatal",{value:!1});Object.defineProperty(k.prototype,"ignoreBOM",{value:!1});var p=q;"function"===typeof Buffer&&Buffer.from?p=t:"function"===typeof Blob&&"function"===typeof URL&&"function"===typeof URL.createObjectURL&&(p=u);k.prototype.decode=function(a,c){c=void 0===c?{stream:!1}:c;if(c.stream)throw Error("Failed to decode: the 'stream' option is unsupported.");
|
|
25996
|
-
a=a instanceof Uint8Array?a:a.buffer instanceof ArrayBuffer?new Uint8Array(a.buffer):new Uint8Array(a);return p(a)};l.TextEncoder=m;l.TextDecoder=k})("undefined"!==typeof window?window:"undefined"!==typeof global?global:this);
|
|
25997
|
-
|
|
25998
|
-
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../buffer/index.js */ "../../node_modules/buffer/index.js").Buffer))
|
|
25999
|
-
|
|
26000
25982
|
/***/ }),
|
|
26001
25983
|
|
|
26002
25984
|
/***/ "../../node_modules/ieee754/index.js":
|
|
@@ -31664,7 +31646,6 @@ var LOG_LEVELS = {
|
|
|
31664
31646
|
WARN: 4,
|
|
31665
31647
|
ERROR: 5
|
|
31666
31648
|
};
|
|
31667
|
-
var COMPATIBLE_PLUGINS = [_Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_CATEGORY"]];
|
|
31668
31649
|
var LOG_TYPE;
|
|
31669
31650
|
|
|
31670
31651
|
(function (LOG_TYPE) {
|
|
@@ -31674,13 +31655,12 @@ var LOG_TYPE;
|
|
|
31674
31655
|
LOG_TYPE["WARN"] = "WARN";
|
|
31675
31656
|
LOG_TYPE["VERBOSE"] = "VERBOSE";
|
|
31676
31657
|
})(LOG_TYPE || (LOG_TYPE = {}));
|
|
31677
|
-
|
|
31678
|
-
var cloudWatchExcludeList = ['AWSCloudWatch', 'Amplify', 'Credentials', 'AuthClass', 'CloudLogger'];
|
|
31679
31658
|
/**
|
|
31680
31659
|
* Write logs
|
|
31681
31660
|
* @class Logger
|
|
31682
31661
|
*/
|
|
31683
31662
|
|
|
31663
|
+
|
|
31684
31664
|
var ConsoleLogger =
|
|
31685
31665
|
/** @class */
|
|
31686
31666
|
function () {
|
|
@@ -31696,19 +31676,8 @@ function () {
|
|
|
31696
31676
|
this.name = name;
|
|
31697
31677
|
this.level = level;
|
|
31698
31678
|
this._pluggables = [];
|
|
31699
|
-
this.addPluggable = this.addPluggable.bind(this);
|
|
31700
31679
|
}
|
|
31701
31680
|
|
|
31702
|
-
ConsoleLogger.globalPluggables = function (pluggable) {
|
|
31703
|
-
if (pluggable && COMPATIBLE_PLUGINS.includes(pluggable.getCategoryName())) {
|
|
31704
|
-
ConsoleLogger._globalpluggables.push(pluggable);
|
|
31705
|
-
}
|
|
31706
|
-
};
|
|
31707
|
-
|
|
31708
|
-
ConsoleLogger.clearGlobalPluggables = function () {
|
|
31709
|
-
ConsoleLogger._globalpluggables = [];
|
|
31710
|
-
};
|
|
31711
|
-
|
|
31712
31681
|
ConsoleLogger.prototype._padding = function (n) {
|
|
31713
31682
|
return n < 10 ? '0' + n : '' + n;
|
|
31714
31683
|
};
|
|
@@ -31723,20 +31692,6 @@ function () {
|
|
|
31723
31692
|
this._config = config;
|
|
31724
31693
|
return this._config;
|
|
31725
31694
|
};
|
|
31726
|
-
|
|
31727
|
-
ConsoleLogger.prototype._checkPluggables = function () {
|
|
31728
|
-
if (this._pluggables.length !== ConsoleLogger._globalpluggables.length) {
|
|
31729
|
-
if (ConsoleLogger._globalpluggables.length > 0) {
|
|
31730
|
-
ConsoleLogger._globalpluggables.forEach(this.addPluggable);
|
|
31731
|
-
|
|
31732
|
-
return;
|
|
31733
|
-
}
|
|
31734
|
-
|
|
31735
|
-
if (ConsoleLogger._globalpluggables.length === 0) {
|
|
31736
|
-
this._pluggables = [];
|
|
31737
|
-
}
|
|
31738
|
-
}
|
|
31739
|
-
};
|
|
31740
31695
|
/**
|
|
31741
31696
|
* Write log
|
|
31742
31697
|
* @method
|
|
@@ -31749,49 +31704,12 @@ function () {
|
|
|
31749
31704
|
ConsoleLogger.prototype._log = function (type) {
|
|
31750
31705
|
var e_1, _a;
|
|
31751
31706
|
|
|
31752
|
-
var _this = this;
|
|
31753
|
-
|
|
31754
31707
|
var msg = [];
|
|
31755
31708
|
|
|
31756
31709
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
31757
31710
|
msg[_i - 1] = arguments[_i];
|
|
31758
31711
|
}
|
|
31759
31712
|
|
|
31760
|
-
if (!cloudWatchExcludeList.includes(this.name)) {
|
|
31761
|
-
this._checkPluggables();
|
|
31762
|
-
}
|
|
31763
|
-
|
|
31764
|
-
var generateMessage = function generateMessage(msg) {};
|
|
31765
|
-
|
|
31766
|
-
var generateCloudMessage = function generateCloudMessage(msg) {
|
|
31767
|
-
var message = '';
|
|
31768
|
-
var data;
|
|
31769
|
-
|
|
31770
|
-
if (msg.length === 1 && typeof msg[0] === 'string') {
|
|
31771
|
-
message = msg[0];
|
|
31772
|
-
} else if (msg.length === 1) {
|
|
31773
|
-
data = msg[0];
|
|
31774
|
-
} else if (typeof msg[0] === 'string') {
|
|
31775
|
-
var obj = msg.slice(1);
|
|
31776
|
-
|
|
31777
|
-
if (obj.length === 1) {
|
|
31778
|
-
obj = obj[0];
|
|
31779
|
-
}
|
|
31780
|
-
|
|
31781
|
-
message = msg[0];
|
|
31782
|
-
data = obj;
|
|
31783
|
-
} else {
|
|
31784
|
-
data = msg;
|
|
31785
|
-
}
|
|
31786
|
-
|
|
31787
|
-
return JSON.stringify({
|
|
31788
|
-
level: type,
|
|
31789
|
-
"class": _this.name,
|
|
31790
|
-
message: message,
|
|
31791
|
-
data: data
|
|
31792
|
-
});
|
|
31793
|
-
};
|
|
31794
|
-
|
|
31795
31713
|
var logger_level_name = this.level;
|
|
31796
31714
|
|
|
31797
31715
|
if (ConsoleLogger.LOG_LEVEL) {
|
|
@@ -31805,72 +31723,62 @@ function () {
|
|
|
31805
31723
|
var logger_level = LOG_LEVELS[logger_level_name];
|
|
31806
31724
|
var type_level = LOG_LEVELS[type];
|
|
31807
31725
|
|
|
31808
|
-
if (type_level >= logger_level) {
|
|
31809
|
-
|
|
31726
|
+
if (!(type_level >= logger_level)) {
|
|
31727
|
+
// Do nothing if type is not greater than or equal to logger level (handle undefined)
|
|
31728
|
+
return;
|
|
31729
|
+
}
|
|
31810
31730
|
|
|
31811
|
-
|
|
31812
|
-
log = console.error.bind(console);
|
|
31813
|
-
}
|
|
31731
|
+
var log = console.log.bind(console);
|
|
31814
31732
|
|
|
31815
|
-
|
|
31816
|
-
|
|
31817
|
-
|
|
31733
|
+
if (type === LOG_TYPE.ERROR && console.error) {
|
|
31734
|
+
log = console.error.bind(console);
|
|
31735
|
+
}
|
|
31818
31736
|
|
|
31819
|
-
|
|
31820
|
-
|
|
31821
|
-
|
|
31737
|
+
if (type === LOG_TYPE.WARN && console.warn) {
|
|
31738
|
+
log = console.warn.bind(console);
|
|
31739
|
+
}
|
|
31822
31740
|
|
|
31823
|
-
|
|
31824
|
-
|
|
31825
|
-
log(prefix + " - " + message);
|
|
31826
|
-
} else if (msg.length === 1) {
|
|
31827
|
-
data = msg[0];
|
|
31828
|
-
log(prefix, data);
|
|
31829
|
-
} else if (typeof msg[0] === 'string') {
|
|
31830
|
-
var obj = msg.slice(1);
|
|
31741
|
+
var prefix = "[" + type + "] " + this._ts() + " " + this.name;
|
|
31742
|
+
var message = '';
|
|
31831
31743
|
|
|
31832
|
-
|
|
31833
|
-
|
|
31834
|
-
|
|
31744
|
+
if (msg.length === 1 && typeof msg[0] === 'string') {
|
|
31745
|
+
message = prefix + " - " + msg[0];
|
|
31746
|
+
log(message);
|
|
31747
|
+
} else if (msg.length === 1) {
|
|
31748
|
+
message = prefix + " " + msg[0];
|
|
31749
|
+
log(prefix, msg[0]);
|
|
31750
|
+
} else if (typeof msg[0] === 'string') {
|
|
31751
|
+
var obj = msg.slice(1);
|
|
31835
31752
|
|
|
31836
|
-
|
|
31837
|
-
|
|
31838
|
-
log(prefix + " - " + message, data);
|
|
31839
|
-
} else {
|
|
31840
|
-
data = msg;
|
|
31841
|
-
log(prefix, data);
|
|
31753
|
+
if (obj.length === 1) {
|
|
31754
|
+
obj = obj[0];
|
|
31842
31755
|
}
|
|
31843
|
-
}
|
|
31844
31756
|
|
|
31845
|
-
|
|
31846
|
-
|
|
31757
|
+
message = prefix + " - " + msg[0] + " " + obj;
|
|
31758
|
+
log(prefix + " - " + msg[0], obj);
|
|
31759
|
+
} else {
|
|
31760
|
+
message = prefix + " " + msg;
|
|
31761
|
+
log(prefix, msg);
|
|
31762
|
+
}
|
|
31847
31763
|
|
|
31848
|
-
|
|
31849
|
-
|
|
31850
|
-
|
|
31851
|
-
|
|
31852
|
-
|
|
31853
|
-
|
|
31854
|
-
message: cloudMessage,
|
|
31855
|
-
timestamp: Date.now()
|
|
31856
|
-
};
|
|
31857
|
-
|
|
31858
|
-
if (type_level_1 >= logger_level_1) {
|
|
31859
|
-
plugin.pushLogs([logEvent]);
|
|
31860
|
-
} else {
|
|
31861
|
-
plugin.pushLogs([]);
|
|
31862
|
-
}
|
|
31863
|
-
}
|
|
31864
|
-
} catch (e_1_1) {
|
|
31865
|
-
e_1 = {
|
|
31866
|
-
error: e_1_1
|
|
31764
|
+
try {
|
|
31765
|
+
for (var _b = __values(this._pluggables), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
31766
|
+
var plugin = _c.value;
|
|
31767
|
+
var logEvent = {
|
|
31768
|
+
message: message,
|
|
31769
|
+
timestamp: Date.now()
|
|
31867
31770
|
};
|
|
31771
|
+
plugin.pushLogs([logEvent]);
|
|
31772
|
+
}
|
|
31773
|
+
} catch (e_1_1) {
|
|
31774
|
+
e_1 = {
|
|
31775
|
+
error: e_1_1
|
|
31776
|
+
};
|
|
31777
|
+
} finally {
|
|
31778
|
+
try {
|
|
31779
|
+
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
|
|
31868
31780
|
} finally {
|
|
31869
|
-
|
|
31870
|
-
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
|
|
31871
|
-
} finally {
|
|
31872
|
-
if (e_1) throw e_1.error;
|
|
31873
|
-
}
|
|
31781
|
+
if (e_1) throw e_1.error;
|
|
31874
31782
|
}
|
|
31875
31783
|
}
|
|
31876
31784
|
};
|
|
@@ -31978,8 +31886,10 @@ function () {
|
|
|
31978
31886
|
};
|
|
31979
31887
|
|
|
31980
31888
|
ConsoleLogger.prototype.addPluggable = function (pluggable) {
|
|
31981
|
-
if (pluggable &&
|
|
31889
|
+
if (pluggable && pluggable.getCategoryName() === _Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_CATEGORY"]) {
|
|
31982
31890
|
this._pluggables.push(pluggable);
|
|
31891
|
+
|
|
31892
|
+
pluggable.configure(this._config);
|
|
31983
31893
|
}
|
|
31984
31894
|
};
|
|
31985
31895
|
|
|
@@ -31987,9 +31897,7 @@ function () {
|
|
|
31987
31897
|
return this._pluggables;
|
|
31988
31898
|
};
|
|
31989
31899
|
|
|
31990
|
-
ConsoleLogger._globalpluggables = [];
|
|
31991
31900
|
ConsoleLogger.LOG_LEVEL = null;
|
|
31992
|
-
ConsoleLogger.CLOUD_LOG_LEVEL = null;
|
|
31993
31901
|
return ConsoleLogger;
|
|
31994
31902
|
}();
|
|
31995
31903
|
|
|
@@ -32837,15 +32745,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32837
32745
|
/* harmony import */ var _Platform__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Platform */ "./lib-esm/Platform/index.js");
|
|
32838
32746
|
/* harmony import */ var _Parser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Parser */ "./lib-esm/Parser.js");
|
|
32839
32747
|
/* harmony import */ var _Util_Constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Util/Constants */ "./lib-esm/Util/Constants.js");
|
|
32840
|
-
function _typeof(obj) {
|
|
32841
|
-
"@babel/helpers - typeof";
|
|
32842
|
-
|
|
32843
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
32844
|
-
return typeof obj;
|
|
32845
|
-
} : function (obj) {
|
|
32846
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
32847
|
-
}, _typeof(obj);
|
|
32848
|
-
}
|
|
32849
32748
|
/*
|
|
32850
32749
|
* Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
32851
32750
|
*
|
|
@@ -32858,8 +32757,6 @@ function _typeof(obj) {
|
|
|
32858
32757
|
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
32859
32758
|
* and limitations under the License.
|
|
32860
32759
|
*/
|
|
32861
|
-
|
|
32862
|
-
|
|
32863
32760
|
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
32864
32761
|
function adopt(value) {
|
|
32865
32762
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -33003,44 +32900,62 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
33003
32900
|
}
|
|
33004
32901
|
};
|
|
33005
32902
|
|
|
32903
|
+
var __read = undefined && undefined.__read || function (o, n) {
|
|
32904
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
32905
|
+
if (!m) return o;
|
|
32906
|
+
var i = m.call(o),
|
|
32907
|
+
r,
|
|
32908
|
+
ar = [],
|
|
32909
|
+
e;
|
|
32910
|
+
|
|
32911
|
+
try {
|
|
32912
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
32913
|
+
ar.push(r.value);
|
|
32914
|
+
}
|
|
32915
|
+
} catch (error) {
|
|
32916
|
+
e = {
|
|
32917
|
+
error: error
|
|
32918
|
+
};
|
|
32919
|
+
} finally {
|
|
32920
|
+
try {
|
|
32921
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
32922
|
+
} finally {
|
|
32923
|
+
if (e) throw e.error;
|
|
32924
|
+
}
|
|
32925
|
+
}
|
|
32926
|
+
|
|
32927
|
+
return ar;
|
|
32928
|
+
};
|
|
32929
|
+
|
|
32930
|
+
var __spread = undefined && undefined.__spread || function () {
|
|
32931
|
+
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
32932
|
+
ar = ar.concat(__read(arguments[i]));
|
|
32933
|
+
}
|
|
33006
32934
|
|
|
32935
|
+
return ar;
|
|
32936
|
+
};
|
|
33007
32937
|
|
|
33008
32938
|
|
|
33009
32939
|
|
|
33010
32940
|
|
|
33011
32941
|
|
|
33012
32942
|
|
|
33013
|
-
if (typeof window === 'undefined' || (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.TextEncoder) {
|
|
33014
|
-
__webpack_require__(/*! fast-text-encoding */ "../../node_modules/fast-text-encoding/text.min.js");
|
|
33015
|
-
}
|
|
33016
32943
|
|
|
33017
32944
|
var logger = new _Logger__WEBPACK_IMPORTED_MODULE_2__["ConsoleLogger"]('AWSCloudWatch');
|
|
33018
|
-
var INTERVAL = 30000;
|
|
33019
32945
|
|
|
33020
32946
|
var AWSCloudWatchProvider =
|
|
33021
32947
|
/** @class */
|
|
33022
32948
|
function () {
|
|
33023
32949
|
function AWSCloudWatchProvider(config) {
|
|
33024
|
-
this.
|
|
33025
|
-
|
|
33026
|
-
|
|
33027
|
-
|
|
33028
|
-
|
|
33029
|
-
|
|
33030
|
-
eventUploadInProgress: false,
|
|
33031
|
-
logEvents: [],
|
|
33032
|
-
verifiedLogGroup: {
|
|
33033
|
-
logGroupName: this._config.logGroupName
|
|
33034
|
-
}
|
|
33035
|
-
};
|
|
33036
|
-
this._currentLogBatch = [];
|
|
33037
|
-
|
|
33038
|
-
this._initiateLogPushInterval();
|
|
33039
|
-
|
|
33040
|
-
this._initialized = true;
|
|
33041
|
-
}
|
|
33042
|
-
} // public static instance: AWSCloudWatchProvider;
|
|
32950
|
+
this.configure(config);
|
|
32951
|
+
this._dataTracker = {
|
|
32952
|
+
eventUploadInProgress: false,
|
|
32953
|
+
logEvents: []
|
|
32954
|
+
};
|
|
32955
|
+
this._currentLogBatch = [];
|
|
33043
32956
|
|
|
32957
|
+
this._initiateLogPushInterval();
|
|
32958
|
+
}
|
|
33044
32959
|
|
|
33045
32960
|
AWSCloudWatchProvider.prototype.getProviderName = function () {
|
|
33046
32961
|
return AWSCloudWatchProvider.PROVIDER_NAME;
|
|
@@ -33054,12 +32969,6 @@ function () {
|
|
|
33054
32969
|
return this._dataTracker.logEvents;
|
|
33055
32970
|
};
|
|
33056
32971
|
|
|
33057
|
-
AWSCloudWatchProvider.prototype.setPreFlightCheck = function (cb) {
|
|
33058
|
-
if (typeof cb === 'function') {
|
|
33059
|
-
this._preFlightCheck = cb;
|
|
33060
|
-
}
|
|
33061
|
-
};
|
|
33062
|
-
|
|
33063
32972
|
AWSCloudWatchProvider.prototype.configure = function (config) {
|
|
33064
32973
|
if (!config) return this._config || {};
|
|
33065
32974
|
var conf = Object.assign({}, this._config, Object(_Parser__WEBPACK_IMPORTED_MODULE_4__["parseMobileHubConfig"])(config).Logging, config);
|
|
@@ -33313,27 +33222,8 @@ function () {
|
|
|
33313
33222
|
};
|
|
33314
33223
|
|
|
33315
33224
|
AWSCloudWatchProvider.prototype.pushLogs = function (logs) {
|
|
33316
|
-
logger.debug('pushing log events to Cloudwatch
|
|
33317
|
-
this._dataTracker.logEvents = this._dataTracker.logEvents
|
|
33318
|
-
};
|
|
33319
|
-
|
|
33320
|
-
AWSCloudWatchProvider.prototype.pause = function () {
|
|
33321
|
-
this._processing = false;
|
|
33322
|
-
|
|
33323
|
-
if (this._timer) {
|
|
33324
|
-
clearInterval(this._timer);
|
|
33325
|
-
}
|
|
33326
|
-
};
|
|
33327
|
-
|
|
33328
|
-
AWSCloudWatchProvider.prototype.resume = function () {
|
|
33329
|
-
this._processing = true;
|
|
33330
|
-
|
|
33331
|
-
this._initiateLogPushInterval();
|
|
33332
|
-
};
|
|
33333
|
-
|
|
33334
|
-
AWSCloudWatchProvider.prototype.clear = function () {
|
|
33335
|
-
this._dataTracker.logEvents = [];
|
|
33336
|
-
this._currentLogBatch = [];
|
|
33225
|
+
logger.debug('pushing log events to Cloudwatch...');
|
|
33226
|
+
this._dataTracker.logEvents = __spread(this._dataTracker.logEvents, logs);
|
|
33337
33227
|
};
|
|
33338
33228
|
|
|
33339
33229
|
AWSCloudWatchProvider.prototype._validateLogGroupExistsAndCreate = function (logGroupName) {
|
|
@@ -33650,33 +33540,13 @@ function () {
|
|
|
33650
33540
|
return __generator(this, function (_a) {
|
|
33651
33541
|
switch (_a.label) {
|
|
33652
33542
|
case 0:
|
|
33653
|
-
_a.trys.push([0,
|
|
33654
|
-
|
|
33655
|
-
return [4
|
|
33656
|
-
/*yield*/
|
|
33657
|
-
, this._preFlightCheck()];
|
|
33658
|
-
|
|
33659
|
-
case 1:
|
|
33660
|
-
/**
|
|
33661
|
-
* CloudWatch has restrictions on the size of the log events that get sent up.
|
|
33662
|
-
* We need to track both the size of each event and the total size of the batch
|
|
33663
|
-
* of logs.
|
|
33664
|
-
*
|
|
33665
|
-
* We also need to ensure that the logs in the batch are sorted in chronological order.
|
|
33666
|
-
* https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
|
|
33667
|
-
*/
|
|
33668
|
-
if (!_a.sent()) {
|
|
33669
|
-
this.clear();
|
|
33670
|
-
return [2
|
|
33671
|
-
/*return*/
|
|
33672
|
-
];
|
|
33673
|
-
}
|
|
33543
|
+
_a.trys.push([0, 3,, 4]);
|
|
33674
33544
|
|
|
33675
33545
|
return [4
|
|
33676
33546
|
/*yield*/
|
|
33677
33547
|
, this._getNextSequenceToken()];
|
|
33678
33548
|
|
|
33679
|
-
case
|
|
33549
|
+
case 1:
|
|
33680
33550
|
seqToken = _a.sent();
|
|
33681
33551
|
logBatch = this._currentLogBatch.length === 0 ? this._getBufferedBatchOfLogs() : this._currentLogBatch;
|
|
33682
33552
|
putLogsPayload = {
|
|
@@ -33690,7 +33560,7 @@ function () {
|
|
|
33690
33560
|
/*yield*/
|
|
33691
33561
|
, this._sendLogEvents(putLogsPayload)];
|
|
33692
33562
|
|
|
33693
|
-
case
|
|
33563
|
+
case 2:
|
|
33694
33564
|
sendLogEventsResponse = _a.sent();
|
|
33695
33565
|
this._nextSequenceToken = sendLogEventsResponse.nextSequenceToken;
|
|
33696
33566
|
this._dataTracker.eventUploadInProgress = false;
|
|
@@ -33699,7 +33569,7 @@ function () {
|
|
|
33699
33569
|
/*return*/
|
|
33700
33570
|
, sendLogEventsResponse];
|
|
33701
33571
|
|
|
33702
|
-
case
|
|
33572
|
+
case 3:
|
|
33703
33573
|
err_5 = _a.sent();
|
|
33704
33574
|
logger.error("error during _safeUploadLogEvents: " + err_5);
|
|
33705
33575
|
|
|
@@ -33716,9 +33586,9 @@ function () {
|
|
|
33716
33586
|
|
|
33717
33587
|
return [3
|
|
33718
33588
|
/*break*/
|
|
33719
|
-
,
|
|
33589
|
+
, 4];
|
|
33720
33590
|
|
|
33721
|
-
case
|
|
33591
|
+
case 4:
|
|
33722
33592
|
return [2
|
|
33723
33593
|
/*return*/
|
|
33724
33594
|
];
|
|
@@ -33837,7 +33707,6 @@ function () {
|
|
|
33837
33707
|
case 3:
|
|
33838
33708
|
err_7 = _a.sent();
|
|
33839
33709
|
logger.error("error when calling _safeUploadLogEvents in the timer interval - " + err_7);
|
|
33840
|
-
this.pause();
|
|
33841
33710
|
return [3
|
|
33842
33711
|
/*break*/
|
|
33843
33712
|
, 4];
|
|
@@ -33849,7 +33718,7 @@ function () {
|
|
|
33849
33718
|
}
|
|
33850
33719
|
});
|
|
33851
33720
|
});
|
|
33852
|
-
},
|
|
33721
|
+
}, 2000);
|
|
33853
33722
|
};
|
|
33854
33723
|
|
|
33855
33724
|
AWSCloudWatchProvider.prototype._getDocUploadPermissibility = function () {
|
|
@@ -34881,7 +34750,7 @@ function () {
|
|
|
34881
34750
|
/*!***********************************!*\
|
|
34882
34751
|
!*** ./lib-esm/Util/Constants.js ***!
|
|
34883
34752
|
\***********************************/
|
|
34884
|
-
/*! exports provided: AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES
|
|
34753
|
+
/*! exports provided: AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES */
|
|
34885
34754
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
34886
34755
|
|
|
34887
34756
|
"use strict";
|
|
@@ -34893,8 +34762,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
34893
34762
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_CLOUDWATCH_PROVIDER_NAME", function() { return AWS_CLOUDWATCH_PROVIDER_NAME; });
|
|
34894
34763
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NO_CREDS_ERROR_STRING", function() { return NO_CREDS_ERROR_STRING; });
|
|
34895
34764
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return RETRY_ERROR_CODES; });
|
|
34896
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_PROVIDER_NAME", function() { return AMAZON_KINESIS_LOGGING_PROVIDER_NAME; });
|
|
34897
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return AMAZON_KINESIS_LOGGING_CATEGORY; });
|
|
34898
34765
|
/*
|
|
34899
34766
|
* Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
34900
34767
|
*
|
|
@@ -34908,14 +34775,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
34908
34775
|
* and limitations under the License.
|
|
34909
34776
|
*/
|
|
34910
34777
|
// Logging constants
|
|
34911
|
-
// Cloudwatch
|
|
34912
34778
|
var AWS_CLOUDWATCH_BASE_BUFFER_SIZE = 26;
|
|
34913
34779
|
var AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = 1048576;
|
|
34914
34780
|
var AWS_CLOUDWATCH_MAX_EVENT_SIZE = 256000;
|
|
34915
34781
|
var AWS_CLOUDWATCH_CATEGORY = 'Logging';
|
|
34916
34782
|
var AWS_CLOUDWATCH_PROVIDER_NAME = 'AWSCloudWatch';
|
|
34917
|
-
var AMAZON_KINESIS_LOGGING_CATEGORY = 'KinesisLogging';
|
|
34918
|
-
var AMAZON_KINESIS_LOGGING_PROVIDER_NAME = 'AmazonKinesisLogging';
|
|
34919
34783
|
var NO_CREDS_ERROR_STRING = 'No credentials';
|
|
34920
34784
|
var RETRY_ERROR_CODES = ['ResourceNotFoundException', 'InvalidSequenceTokenException'];
|
|
34921
34785
|
|
|
@@ -35618,7 +35482,7 @@ function urlSafeDecode(hex) {
|
|
|
35618
35482
|
/*!*******************************!*\
|
|
35619
35483
|
!*** ./lib-esm/Util/index.js ***!
|
|
35620
35484
|
\*******************************/
|
|
35621
|
-
/*! exports provided: NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES
|
|
35485
|
+
/*! exports provided: NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES */
|
|
35622
35486
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
35623
35487
|
|
|
35624
35488
|
"use strict";
|
|
@@ -35659,10 +35523,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35659
35523
|
|
|
35660
35524
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["RETRY_ERROR_CODES"]; });
|
|
35661
35525
|
|
|
35662
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_PROVIDER_NAME", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["AMAZON_KINESIS_LOGGING_PROVIDER_NAME"]; });
|
|
35663
|
-
|
|
35664
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["AMAZON_KINESIS_LOGGING_CATEGORY"]; });
|
|
35665
|
-
|
|
35666
35526
|
|
|
35667
35527
|
|
|
35668
35528
|
|
|
@@ -35712,7 +35572,7 @@ var USER_AGENT_HEADER = 'x-amz-user-agent';
|
|
|
35712
35572
|
/*!**************************!*\
|
|
35713
35573
|
!*** ./lib-esm/index.js ***!
|
|
35714
35574
|
\**************************/
|
|
35715
|
-
/*! exports provided: AmplifyClass, ClientDevice, ConsoleLogger, Logger, missingConfig, invalidParameter, Hub, I18n, isEmpty, sortByField, objectLessAttributes, filenameToContentType, isTextFile, generateRandomString, makeQuerablePromise, isWebWorker, browserOrNode, transferKeyToLowerCase, transferKeyToUpperCase, isStrictObject, JS, Signer, parseMobileHubConfig, Parser, AWSCloudWatchProvider, FacebookOAuth, GoogleOAuth, Linking, AppState, AsyncStorage, Credentials, CredentialsClass, ServiceWorker, StorageHelper, MemoryStorage, UniversalStorage, Platform, getAmplifyUserAgent, INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER, INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, Constants, NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES,
|
|
35575
|
+
/*! exports provided: AmplifyClass, ClientDevice, ConsoleLogger, Logger, missingConfig, invalidParameter, Hub, I18n, isEmpty, sortByField, objectLessAttributes, filenameToContentType, isTextFile, generateRandomString, makeQuerablePromise, isWebWorker, browserOrNode, transferKeyToLowerCase, transferKeyToUpperCase, isStrictObject, JS, Signer, parseMobileHubConfig, Parser, AWSCloudWatchProvider, FacebookOAuth, GoogleOAuth, Linking, AppState, AsyncStorage, Credentials, CredentialsClass, ServiceWorker, StorageHelper, MemoryStorage, UniversalStorage, Platform, getAmplifyUserAgent, INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER, INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, Constants, NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, Amplify, default */
|
|
35716
35576
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
35717
35577
|
|
|
35718
35578
|
"use strict";
|
|
@@ -35851,10 +35711,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35851
35711
|
|
|
35852
35712
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["RETRY_ERROR_CODES"]; });
|
|
35853
35713
|
|
|
35854
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_PROVIDER_NAME", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["AMAZON_KINESIS_LOGGING_PROVIDER_NAME"]; });
|
|
35855
|
-
|
|
35856
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["AMAZON_KINESIS_LOGGING_CATEGORY"]; });
|
|
35857
|
-
|
|
35858
35714
|
/*
|
|
35859
35715
|
* Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
35860
35716
|
*
|