@pisell/core 1.0.48 → 1.0.50
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/es/logger/index.js +14 -13
- package/es/request/constants.js +1 -1
- package/es/request/index.js +5 -3
- package/lib/logger/index.js +0 -11
- package/lib/request/constants.js +1 -1
- package/lib/request/index.js +2 -2
- package/package.json +1 -1
package/es/logger/index.js
CHANGED
|
@@ -449,26 +449,27 @@ var LoggerManager = /*#__PURE__*/function () {
|
|
|
449
449
|
return (_this$db2 = this.db) === null || _this$db2 === void 0 ? void 0 : _this$db2.clear("logs");
|
|
450
450
|
case 17:
|
|
451
451
|
console.log("-------- 清空IndexDB日志成功");
|
|
452
|
-
_context5.next =
|
|
452
|
+
_context5.next = 24;
|
|
453
453
|
break;
|
|
454
454
|
case 20:
|
|
455
455
|
_context5.prev = 20;
|
|
456
456
|
_context5.t0 = _context5["catch"](0);
|
|
457
457
|
console.log("-------- 存储日志到IndexDB 失败", _context5.t0);
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
458
|
+
|
|
459
|
+
// this.sendFeishuNotification({
|
|
460
|
+
// type: "error",
|
|
461
|
+
// title: "存储IndexDB日志到AWS失败",
|
|
462
|
+
// metadata: {
|
|
463
|
+
// error: {
|
|
464
|
+
// name: error?.name,
|
|
465
|
+
// message: error?.message,
|
|
466
|
+
// stack: error?.stack,
|
|
467
|
+
// }
|
|
468
|
+
// },
|
|
469
|
+
// });
|
|
469
470
|
// 重新抛出错误,让外层 catch 能够捕获
|
|
470
471
|
throw _context5.t0;
|
|
471
|
-
case
|
|
472
|
+
case 24:
|
|
472
473
|
case "end":
|
|
473
474
|
return _context5.stop();
|
|
474
475
|
}
|
package/es/request/constants.js
CHANGED
package/es/request/index.js
CHANGED
|
@@ -64,7 +64,7 @@ export var createRequest = function createRequest(props) {
|
|
|
64
64
|
// 如果请求计数超过最大请求数,则记录为警告日志
|
|
65
65
|
if (requestCount > ((logger === null || logger === void 0 ? void 0 : logger.maxRequestCount) || 6)) {
|
|
66
66
|
app.logger.addLog({
|
|
67
|
-
type: '
|
|
67
|
+
type: 'info',
|
|
68
68
|
title: "[ Request ]: Max Request Count - ".concat(requestCount),
|
|
69
69
|
metadata: {
|
|
70
70
|
requestCount: requestCount
|
|
@@ -89,14 +89,16 @@ export var createRequest = function createRequest(props) {
|
|
|
89
89
|
maxRequestTime = 99999999;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
//
|
|
92
|
+
// 如果请求时间超过最大时间,则记录为警告日志
|
|
93
93
|
var type = duration > maxRequestTime ? 'warning' : 'info';
|
|
94
|
+
|
|
95
|
+
// 如果请求失败,则记录为错误日志
|
|
94
96
|
if (isError) {
|
|
95
97
|
type = 'error';
|
|
96
98
|
}
|
|
97
99
|
app.logger.addLog({
|
|
98
100
|
type: type,
|
|
99
|
-
title: "[ Request ]: Complete - ".concat(requestId),
|
|
101
|
+
title: "[ Request ]: Complete - ".concat(requestId, " \u8D85\u8FC75s"),
|
|
100
102
|
metadata: {
|
|
101
103
|
error: isError ? JSON.stringify(result) : '',
|
|
102
104
|
duration: "".concat((duration / 1000).toFixed(2), "s"),
|
package/lib/logger/index.js
CHANGED
|
@@ -287,17 +287,6 @@ var LoggerManager = class {
|
|
|
287
287
|
console.log("-------- 清空IndexDB日志成功");
|
|
288
288
|
} catch (error) {
|
|
289
289
|
console.log("-------- 存储日志到IndexDB 失败", error);
|
|
290
|
-
this.sendFeishuNotification({
|
|
291
|
-
type: "error",
|
|
292
|
-
title: "存储IndexDB日志到AWS失败",
|
|
293
|
-
metadata: {
|
|
294
|
-
error: {
|
|
295
|
-
name: error == null ? void 0 : error.name,
|
|
296
|
-
message: error == null ? void 0 : error.message,
|
|
297
|
-
stack: error == null ? void 0 : error.stack
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
290
|
throw error;
|
|
302
291
|
}
|
|
303
292
|
}
|
package/lib/request/constants.js
CHANGED
package/lib/request/index.js
CHANGED
|
@@ -76,7 +76,7 @@ var createRequest = (props) => {
|
|
|
76
76
|
});
|
|
77
77
|
if (requestCount > ((logger == null ? void 0 : logger.maxRequestCount) || 6)) {
|
|
78
78
|
app.logger.addLog({
|
|
79
|
-
type: "
|
|
79
|
+
type: "info",
|
|
80
80
|
title: `[ Request ]: Max Request Count - ${requestCount}`,
|
|
81
81
|
metadata: {
|
|
82
82
|
requestCount
|
|
@@ -100,7 +100,7 @@ var createRequest = (props) => {
|
|
|
100
100
|
}
|
|
101
101
|
app.logger.addLog({
|
|
102
102
|
type,
|
|
103
|
-
title: `[ Request ]: Complete - ${requestId2}`,
|
|
103
|
+
title: `[ Request ]: Complete - ${requestId2} 超过5s`,
|
|
104
104
|
metadata: {
|
|
105
105
|
error: isError ? JSON.stringify(result) : "",
|
|
106
106
|
duration: `${(duration / 1e3).toFixed(2)}s`,
|