Request logging
Overview
Legacy API logs are one line per event, with scalar key=value fields, so Clever log search can filter by area (documents, files, HTTP) without dumping request bodies or Mongoose documents.
How it works
app/middleware/logger.js derives [service] from the caller file path and prints [I], [W], or [E].
- HTTP middleware logs
requestat info. - Document ingest logs
saved fileandcreated document.bcyip_agentandversioncome fromBcyip-AgentandBcyip-Versionand are omitted when blank. - Credits and Mongo connect log at info. Client 4xx logs at warn. Zip, download, and Mongo failures log at error.
saved-file-log.jsemitssaved filewithout requiringfiles.jsfromdocuments.linkFile, which previously broke the documents/files circular load and leftlogSavedFileundefined.pipeStreamToResponsehandles pkgcloud, archiver, and busboy stream errors without sending a second HTTP 500.
Key files
app/middleware/logger.js— Line format and request middlewareapp/middleware/logger-core.js— Scalar field formattingapp/services/saved-file-log.js— Ingestsaved filelinesapp/util/http-stream.js— Stream error guard
Technical decisions
- Scalar fields only. Objects, documents, and raw errors are not passed to the logger.
- The service name comes from the caller path so routes do not pass a label on every call.