@nocobase/logger 1.3.44-beta → 1.4.0-alpha.0

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.
@@ -42,8 +42,14 @@ const defaultRequestWhitelist = [
42
42
  "referer"
43
43
  ];
44
44
  const defaultResponseWhitelist = ["status"];
45
+ const defaultActionBlackList = [
46
+ "params.values.password",
47
+ "params.values.confirmPassword",
48
+ "params.values.oldPassword",
49
+ "params.values.newPassword"
50
+ ];
45
51
  const requestLogger = /* @__PURE__ */ __name((appName, requestLogger2, options) => {
46
- return async (ctx, next) => {
52
+ return /* @__PURE__ */ __name(async function requestLoggerMiddleware(ctx, next) {
47
53
  var _a, _b, _c, _d, _e, _f, _g, _h;
48
54
  const reqId = ctx.reqId;
49
55
  const path = /^\/api\/(.+):(.+)/.exec(ctx.path);
@@ -74,12 +80,13 @@ const requestLogger = /* @__PURE__ */ __name((appName, requestLogger2, options)
74
80
  message: `response ${ctx.url}`,
75
81
  ...requestInfo,
76
82
  res: (0, import_lodash.pick)(ctx.response.toJSON(), (options == null ? void 0 : options.responseWhitelist) || defaultResponseWhitelist),
77
- action: (_d = (_c = ctx.action) == null ? void 0 : _c.toJSON) == null ? void 0 : _d.call(_c),
83
+ action: (0, import_lodash.omit)((_d = (_c = ctx.action) == null ? void 0 : _c.toJSON) == null ? void 0 : _d.call(_c), defaultActionBlackList),
78
84
  userId: (_f = (_e = ctx.auth) == null ? void 0 : _e.user) == null ? void 0 : _f.id,
79
85
  status: ctx.status,
80
86
  cost,
81
87
  app: appName,
82
- reqId
88
+ reqId,
89
+ bodySize: ctx.response.length
83
90
  };
84
91
  if (Math.floor(status / 100) == 5) {
85
92
  requestLogger2.error({ ...info, res: ((_g = ctx.body) == null ? void 0 : _g["errors"]) || ctx.body });
@@ -93,7 +100,7 @@ const requestLogger = /* @__PURE__ */ __name((appName, requestLogger2, options)
93
100
  if (error) {
94
101
  throw error;
95
102
  }
96
- };
103
+ }, "requestLoggerMiddleware");
97
104
  }, "requestLogger");
98
105
  // Annotate the CommonJS export names for ESM import in node:
99
106
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/logger",
3
- "version": "1.3.44-beta",
3
+ "version": "1.4.0-alpha.0",
4
4
  "description": "nocobase logging library",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "./lib/index.js",
@@ -18,5 +18,5 @@
18
18
  "winston-daily-rotate-file": "^5.0.0",
19
19
  "winston-transport": "^4.7.0"
20
20
  },
21
- "gitHead": "1d5666123ac1e2997e434e38defef963ba0d9f90"
21
+ "gitHead": "8ffa7b54bbaf720c0c9857da4b19a99110dffc4b"
22
22
  }