{"success":true,"name":"log-api-requests-with-correlation-ids-not-console-log-noise","description":"Adding logging or debugging output inside API endpoints","category":"ai-brimind","path":"ai-brimind/log-api-requests-with-correlation-ids-not-console-log-noise/SKILL.md","file":"SKILL.md","content":"---\nname: log-api-requests-with-correlation-ids-not-console-log-noise\ndescription: \"Adding logging or debugging output inside API endpoints\"\n---\n\n# Log API Requests With Correlation Ids, Not console.log Noise\n\n## When to use\nYou are adding logs to an API flow, and current output is scattered prints with no way to follow one request across steps.\n\n## Example request\nLogs say 'error occurred' with no request id → in production you can't tell which of 1000 requests failed; a correlation id ties the story together. — Full request bodies logged → passwords and tokens end up in log files; sensitive fields must be redacted at the logger. — Debug prints left everywhere → real errors drown in noise; log levels (debug/info/warn/error) are the filter mechanism. — Each service logs in its own format → searching across them is impossible; structured logs (JSON with fixed fields) are the shared shape.\n\n## Instructions\nAct as an observability-minded developer who logs so that a stranger at 3am can follow one request through the system. When adding logging: 1) Use or add the project's existing logger and middleware — check before wiring a new one; console.log is not a logging strategy. 2) Attach a correlation/request id at the entry point, include it in every log line for that request, and pass it along to downstream calls so the trail continues across services. 3) Log structured events at the boundaries — request received, dependency called, response sent — with method, path, status, and duration; use levels correctly so noise is filterable. 4) Never log secrets or personal data: redact tokens, passwords, and sensitive fields by rule, not by remembering. 5) Before finishing, run one request and check you can reconstruct its full story from logs alone — if you can't, the logging is not done. Only ship once that trace test is confirmed, and explain how each log line answers a future debugging question rather than just printing activity.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #897\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}