Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat(claude-md): logging standard

x0322055e272822a69d
diff --git a/backend/CLAUDE.md b/backend/CLAUDE.md
index b6aff682cd..282cdb41f9 100644
--- a/backend/CLAUDE.md
+++ b/backend/CLAUDE.md
@@ -148,6 +148,21 @@ Custom error classes in `src/lib/errors/index.ts`:
Global error handler in `src/server/plugins/error-handler.ts` maps these to HTTP status codes and records OpenTelemetry error metrics.
+### Logging
+
+Uses Pino via `@app/lib/logger`. Always include key identifiers in the message string using `[key=value]` format for log searchability. You may also pass a structured object as the first argument for programmatic access, but the message must be self-contained:
+
+```ts
+// Preferred: identifiers in message + structured object
+logger.error({ sessionId, err }, `Failed to get connection details [sessionId=${sessionId}]`);
+
+// Also acceptable: identifiers in message only
+logger.info(`getPlan: Process done for [orgId=${orgId}] [projectId=${projectId}]`);
+
+// NOT preferred: identifiers only in structured object, not in message
+logger.error({ sessionId, err }, "Failed to get connection details");
+```
+
### Enterprise (EE) Features
Enterprise code lives in `src/ee/`: