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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
refactor(logging): drop unused withRequestLogging edge helper
Sidwebworks60950b1989af
diff --git a/packages/database/AGENTS.md b/packages/database/AGENTS.mdindex 39e4ed6441..21ee5e4fcd 100644--- a/packages/database/AGENTS.md+++ b/packages/database/AGENTS.md@@ -48,4 +48,4 @@ pnpm --filter @carbon/database typecheck- `.ai/rules/event-system.md` — trigger dispatch, PGMQ queue, handler types- `packages/auth/` — Supabase client factories (`getCarbon`, `getCarbonServiceRole`)- `packages/jobs/` — Inngest event handlers that consume the event queue-- `supabase/functions/lib/logging.ts` — Deno-native logger (`getFunctionLogger`, `withRequestLogging`) mirroring `@carbon/logger`; use it instead of `console.*` in edge functions (`@logtape/*` via `deno.json` jsr imports)+- `supabase/functions/lib/logging.ts` — Deno-native logger (`getFunctionLogger`) mirroring `@carbon/logger`; use it instead of `console.*` in edge functions (`@logtape/*` via `deno.json` jsr imports)diff --git a/packages/database/supabase/functions/lib/logging.ts b/packages/database/supabase/functions/lib/logging.tsindex 4384f35c7f..829659722f 100644--- a/packages/database/supabase/functions/lib/logging.ts+++ b/packages/database/supabase/functions/lib/logging.ts@@ -1,11 +1,9 @@-import { AsyncLocalStorage } from "node:async_hooks";import {configureSync,getConsoleSink,getJsonLinesFormatter,getLogger,type Logger,- withContext,} from "@logtape/logtape";import { redactByField } from "@logtape/redaction";@@ -27,8 +25,6 @@ const LOG_LEVELS = [] as const;type Level = (typeof LOG_LEVELS)[number];-const REQUEST_ID_HEADER = "x-request-id";-let configured = false;function ensureConfigured(): void {@@ -42,7 +38,6 @@ function ensureConfigured(): void {configureSync({reset: true,- contextLocalStorage: new AsyncLocalStorage(),sinks: {console: redactByField(getConsoleSink({ formatter: getJsonLinesFormatter() })@@ -62,32 +57,3 @@ export function getFunctionLogger(fnName: string): Logger {ensureConfigured();return getLogger(["carbon", "edge", fnName]);}--/**- * Wrap an edge-function handler so every log during the request carries a- * request id (reused from `x-request-id` or generated) and the function name,- * and the id is echoed on the response.- */-export function withRequestLogging(- fnName: string,- handler: (req: Request) => Promise<Response> | Response-): (req: Request) => Promise<Response> {- return async (req) => {- ensureConfigured();- const requestId =- req.headers.get(REQUEST_ID_HEADER) ?? crypto.randomUUID();- const response = await withContext(- { requestId, function: fnName },- async () => await handler(req)- );- // Rebuild with copied headers — a handler may return a Response with an- // immutable header guard (e.g. one from `fetch`), where `.set()` throws.- const headers = new Headers(response.headers);- headers.set(REQUEST_ID_HEADER, requestId);- return new Response(response.body, {- status: response.status,- statusText: response.statusText,- headers,- });- };-}diff --git a/packages/logger/AGENTS.md b/packages/logger/AGENTS.mdindex 6cce1b24c6..de19500250 100644--- a/packages/logger/AGENTS.md+++ b/packages/logger/AGENTS.md@@ -83,5 +83,5 @@ pnpm --filter @carbon/logger test- `packages/lib/src/inngest/client.ts` — consumes `createInngestLogger()`.- `packages/database/supabase/functions/lib/logging.ts` — Deno-native twin- (`getFunctionLogger`, `withRequestLogging`), configured from `jsr:@logtape/*`.+ (`getFunctionLogger`), configured from `jsr:@logtape/*`.- `packages/env/` — defines `LOG_LEVEL` (also exposed to `window.env`).