@less-is-more/less-js 1.2.28 → 1.2.29
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/package.json +1 -1
- package/src/router.js +10 -8
package/package.json
CHANGED
package/src/router.js
CHANGED
|
@@ -37,9 +37,9 @@ module.exports = class Router {
|
|
|
37
37
|
console.log("start after action");
|
|
38
38
|
await targets.after(req, res, context);
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
const useTime = (new Date().getTime() - startTime) / 1000;
|
|
41
41
|
// controller方法有返回值的自动send
|
|
42
|
-
this._handleReturn(result, res);
|
|
42
|
+
this._handleReturn(result, useTime, req, res);
|
|
43
43
|
} catch (e) {
|
|
44
44
|
console.log(e);
|
|
45
45
|
return this._sendError(e.message ? e.message : "出错啦", res);
|
|
@@ -108,7 +108,7 @@ module.exports = class Router {
|
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
static _handleReturn(result, res) {
|
|
111
|
+
static _handleReturn(result, useTime, req, res) {
|
|
112
112
|
if (!Param.isBlank(result)) {
|
|
113
113
|
let content;
|
|
114
114
|
if (result instanceof Ret) {
|
|
@@ -120,11 +120,13 @@ module.exports = class Router {
|
|
|
120
120
|
content = JSON.stringify(result);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
console.log(
|
|
124
|
+
req.headers["x-fc-request-id"],
|
|
125
|
+
useTime + "s",
|
|
126
|
+
req.path,
|
|
127
|
+
"response:",
|
|
128
|
+
content.length > 500 ? content.substring(0, 500) : content
|
|
129
|
+
);
|
|
128
130
|
res.send(content);
|
|
129
131
|
}
|
|
130
132
|
}
|