kb-server 0.0.8 → 0.0.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.
@@ -27,7 +27,7 @@ const packAPI = (apis, options) => {
27
27
  const { Action, ...params } = req.body || {};
28
28
  try {
29
29
  if (log) {
30
- logger_1.logger.info({ requestId, action: Action, params }, "请求入参");
30
+ logger_1.logger.info({ requestId, action: Action, params, path: req.path }, "请求入参");
31
31
  }
32
32
  // 接口未定义
33
33
  if (!Action) {
@@ -67,7 +67,15 @@ const packAPI = (apis, options) => {
67
67
  return res.send(response);
68
68
  }
69
69
  catch (rawError) {
70
- logger_1.logger.error({ requestId, action: Action, error: rawError }, "请求处理异常");
70
+ // 检查是否有堆栈信息,如果有则添加到日志中
71
+ const errorLog = {
72
+ requestId,
73
+ action: Action,
74
+ error: rawError,
75
+ // 添加堆栈信息
76
+ stack: rawError?.stack,
77
+ };
78
+ logger_1.logger.error(errorLog, "请求处理异常");
71
79
  // 未知错误
72
80
  let error = new create_errors_1.CommonErrors.InternalError.UnknownError();
73
81
  // 可控错误
@@ -37,7 +37,7 @@ const packSSE = (sseHandlers, options) => {
37
37
  const { Action, ...params } = req.body || {};
38
38
  try {
39
39
  if (log) {
40
- logger_1.logger.info({ requestId, action: Action, params }, "SSE请求入参");
40
+ logger_1.logger.info({ requestId, action: Action, params, path: req.path }, "SSE请求入参");
41
41
  }
42
42
  // 接口未定义
43
43
  if (!Action) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kb-server",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "A fast server for Node.JS,made by express.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {