@rdyl/node-koa-controller 0.3.0 → 0.3.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.
- package/CHANGELOG.md +1 -1
- package/dist/utils.js +8 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/utils.js
CHANGED
|
@@ -84,21 +84,19 @@ function getIPAdress() {
|
|
|
84
84
|
}
|
|
85
85
|
function RunningLogsHandler(ctx, next) {
|
|
86
86
|
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
var start, duration, status_1, method, statusColor, dateTime, dText;
|
|
87
|
+
var start, duration, status_1, method, statusColor, dateTime, dText, err_1;
|
|
88
88
|
return __generator(this, function (_a) {
|
|
89
89
|
switch (_a.label) {
|
|
90
90
|
case 0:
|
|
91
91
|
start = Date.now();
|
|
92
92
|
_a.label = 1;
|
|
93
93
|
case 1:
|
|
94
|
-
_a.trys.push([1, ,
|
|
94
|
+
_a.trys.push([1, 3, , 4]);
|
|
95
95
|
return [4 /*yield*/, next()];
|
|
96
96
|
case 2:
|
|
97
97
|
_a.sent();
|
|
98
|
-
return [3 /*break*/, 4];
|
|
99
|
-
case 3:
|
|
100
98
|
duration = Date.now() - start;
|
|
101
|
-
status_1 = ctx.status;
|
|
99
|
+
status_1 = ctx.response.status;
|
|
102
100
|
method = ctx.method;
|
|
103
101
|
statusColor = void 0;
|
|
104
102
|
if (status_1 >= 500)
|
|
@@ -120,7 +118,11 @@ function RunningLogsHandler(ctx, next) {
|
|
|
120
118
|
dText = chalk_1.default.yellow("".concat(duration, "ms"));
|
|
121
119
|
}
|
|
122
120
|
console.log("- [".concat(dateTime, " | ").concat(dText, "] ").concat(chalk_1.default.magenta(method), " ").concat(ctx.url, " ").concat(statusColor(status_1)));
|
|
123
|
-
return [
|
|
121
|
+
return [3 /*break*/, 4];
|
|
122
|
+
case 3:
|
|
123
|
+
err_1 = _a.sent();
|
|
124
|
+
console.log(err_1);
|
|
125
|
+
return [3 /*break*/, 4];
|
|
124
126
|
case 4: return [2 /*return*/];
|
|
125
127
|
}
|
|
126
128
|
});
|