@arkstack/driver-express 0.17.14 → 0.17.16

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.
@@ -170,16 +170,19 @@ const colors = {
170
170
  */
171
171
  const requestLogger = ({ allowInProduction = false } = {}) => async (req, res, next) => {
172
172
  const VERBOSE = process.env.VERBOSITY != "0";
173
- if (nodeEnv() === "prod" && !allowInProduction || !VERBOSE) return next();
174
- const start = Date.now();
175
- const status = res.statusCode || 200;
176
- const duration = Date.now() - start;
177
- Logger.log([
178
- [`[${req.method}]`, colors[req.method] || "white"],
179
- [req.url, "cyan"],
180
- [status.toString(), status >= 500 ? "red" : status >= 400 ? "yellow" : "green"],
181
- [`- ${duration}ms`, "dim"]
182
- ], " ");
173
+ const startedAt = performance.now();
174
+ res.once("finish", () => {
175
+ if (nodeEnv() === "prod" && !allowInProduction || !VERBOSE) return;
176
+ if (process.env.NODE_ENV === "test" || process.env.VITEST) return;
177
+ const status = res.statusCode || 200;
178
+ const duration = Math.round((performance.now() - startedAt) * 100) / 100;
179
+ Logger.log([
180
+ [`[${req.method}]`, colors[req.method] || "white"],
181
+ [req.url, "cyan"],
182
+ [status.toString(), status >= 500 ? "red" : status >= 400 ? "yellow" : "green"],
183
+ [`- ${duration}ms`, "dim"]
184
+ ], " ");
185
+ });
183
186
  next();
184
187
  };
185
188
  var RequestLoggerMiddleware = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/driver-express",
3
- "version": "0.17.14",
3
+ "version": "0.17.16",
4
4
  "type": "module",
5
5
  "description": "Express driver for Arkstack, providing Express-based runtime integration for the framework.",
6
6
  "homepage": "https://arkstack.toneflix.net",
@@ -43,15 +43,15 @@
43
43
  "express-rate-limit": "^8.4.1",
44
44
  "multer": "^2.1.1",
45
45
  "resora": "^1.3.32",
46
- "@arkstack/contract": "^0.17.14",
47
- "@arkstack/http": "^0.17.14"
46
+ "@arkstack/contract": "^0.17.16",
47
+ "@arkstack/http": "^0.17.16"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "express": "^5.2.1",
51
- "@arkstack/common": "^0.17.14",
52
- "@arkstack/auth": "^0.17.14",
53
- "@arkstack/foundry": "^0.17.14",
54
- "@arkstack/inertia": "^0.17.14"
51
+ "@arkstack/auth": "^0.17.16",
52
+ "@arkstack/foundry": "^0.17.16",
53
+ "@arkstack/inertia": "^0.17.16",
54
+ "@arkstack/common": "^0.17.16"
55
55
  },
56
56
  "peerDependenciesMeta": {
57
57
  "@arkstack/auth": {