Request logging
Overview
Neo request and error logs follow the legacy backend format: one line per event, scalar fields, and a [Service] prefix. A rejected document create is visible as document ingest rejected instead of a silent 400.
How it works
Logger formats log, warn, and error with scalar fields or an Error. The request middleware logs one line per HTTP call. Document ingest logs created document on success and document ingest rejected (warn) when Bcyip-Agent is missing, the agent does not match the token, or fileId is missing. Client 4xx responses log client error. 5xx responses stay on error as a single line.
Searchable fields are written 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.
Key files
src/core/logger/logger.service.ts— One-line formattersrc/shared/middleware/request-log.middleware.ts— HTTP request linesrc/domains/document/document.service.ts— Ingest success and rejection linessrc/core/error/global-exception.filter.ts— 4xxclient errorsrc/core/error/error.service.ts— 5xx line
Technical decisions
- Same shape as legacy backend logs so operators can search both services the same way.
- Rejection reasons are logged before the exception is thrown, with the ids already known on the request.