Readable request and error logs
Version: 1.2.2 Date: 2026-10-23
Goal: Match legacy backend request logs: one line per event, scalar fields, no multiline dumps.
Solution: A request middleware, created document and client error (4xx) lines, 5xx errors as scalars, and replacement of logger.error(err) / console.* on the request, ingest, and exception-filter path. Logger formats log / warn / error with scalar fields or an Error, and a [Service] prefix on the same line as the message. Searchable fields are included when the value is known (email, name, document_id, document_name, hash, file_id, file_name, job_id, company_id). printPipeline still prints the aggregation pipeline JSON in its own Nest context.
Files Modified:
src/core/logger/logger.service.ts- One-line format ([Service]plus scalar fields and Error)src/core/auth/auth.service.ts-firstName/lastNameprojection for auth logssrc/core/logger/logger.service.spec.ts- Logger format testssrc/shared/middleware/request-log.middleware.ts- One line per HTTP requestsrc/app.module.ts- Register the request middlewaresrc/core/error/error.service.ts- 5xx only, one linesrc/core/error/global-exception.filter.ts- Warnclient errorfor 4xxsrc/domains/gateway/exceptions/gateway-exception.filter.ts- Warnclient erroron the gatewaysrc/domains/document/document.service.ts- Ingest success and denied proof accesssrc/domains/document/document.controller.ts- Duplicate-hash failuresrc/domains/document/document.controller.spec.ts- Logger mocksrc/core/auth/middleware/authorization.middleware.ts- Rejected token on one linesrc/core/database/database.provider.ts- Database connection failure on one linesrc/domains/gateway/gateway.controller.ts- Magic link errors on one linesrc/domains/gateway/services/config.service.ts- OAuth config parse on one linesrc/domains/gateway/services/keyvault.service.ts- Key Vault errors on one linesrc/domains/gateway/services/magic-link.service.ts- Token validation on one linesrc/domains/gateway/services/auth-strategy-detector.service.ts- Strategy detection on one linesrc/domains/gateway/services/oauth.service.ts- OAuth errors on one line
Release fragment: fix-log-ingest-header-rejection