Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

refactor(logging): status code right after method in access line

Sidwebworksf147d3b872a4
diff --git a/packages/logger/src/http-formatter.test.ts b/packages/logger/src/http-formatter.test.ts
index 5aef7edffe..32fc3b3765 100644
--- a/packages/logger/src/http-formatter.test.ts
+++ b/packages/logger/src/http-formatter.test.ts
@@ -49,7 +49,7 @@ describe("httpDevFormatter", () => {
})
);
expect(line).toContain(
- "\x1b[1m\x1b[32mGET\x1b[0m /dashboard \x1b[32m200\x1b[0m \x1b[2m12.3 ms\x1b[0m"
+ "\x1b[1m\x1b[32mGET\x1b[0m \x1b[32m200\x1b[0m /dashboard \x1b[2m12.3 ms\x1b[0m"
);
});
@@ -103,7 +103,7 @@ describe("httpDevFormatter", () => {
const line = httpDevFormatter(
record({ method: "GET", pathname: "/x", status: 200 })
);
- expect(line).toContain("\x1b[1m\x1b[32mGET\x1b[0m /x \x1b[32m200\x1b[0m");
+ expect(line).toContain("\x1b[1m\x1b[32mGET\x1b[0m \x1b[32m200\x1b[0m /x");
expect(line).not.toContain("ms");
});
diff --git a/packages/logger/src/http-formatter.ts b/packages/logger/src/http-formatter.ts
index 349ef9186f..d2e3d83fe0 100644
--- a/packages/logger/src/http-formatter.ts
+++ b/packages/logger/src/http-formatter.ts
@@ -72,7 +72,7 @@ export const httpDevFormatter: TextFormatter = getAnsiColorFormatter({
? ` ${DIM}${Math.trunc(responseTime * 10) / 10} ms${RESET}`
: "";
const methodColor = METHOD_COLOR[method] ?? RESET;
- line = `${BOLD}${methodColor}${method}${RESET} ${pathname}${query} ${statusColor(status)}${status}${RESET}${time}`;
+ line = `${BOLD}${methodColor}${method}${RESET} ${statusColor(status)}${status}${RESET} ${pathname}${query}${time}`;
// The Morgan line only renders method/path/status/time, so a captured
// request body (debug only, already redacted) would otherwise be dropped
// — append it dimmed on its own line.