{"success":true,"name":"make-the-system-tell-you-what-happened-log-with-intent","description":"System runs across layers but failures leave no readable story behind","category":"ai-brimind","path":"ai-brimind/make-the-system-tell-you-what-happened-log-with-intent/SKILL.md","file":"SKILL.md","content":"---\nname: make-the-system-tell-you-what-happened-log-with-intent\ndescription: \"System runs across layers but failures leave no readable story behind\"\n---\n\n# Make the System Tell You What Happened: Log With Intent\n\n## When to use\nSystem runs across layers but failures leave no readable story behind\n\n## Example request\nUser reports 'payment failed yesterday' → logs contain nothing searchable, so the answer is archaeology in the DB; the concept is logging key events with context (who, what, when, result). Logs exist but are console.log('here') and giant object dumps → unreadable noise nobody can search; the concept is structured, leveled logging (info/warn/error with named fields). An error is logged as 'Error: failed' → no user ID, no request data, no stack; the concept is context-rich error entries. One user's request weaves through route → service → external API → but each log line is disconnected; the concept is correlating a request's trail (an ID that follows it through the layers).\n\n## Instructions\nAct as the future debugger of this system, writing today the log lines that person will desperately need. Build logging with intent, not as leftovers: (1) LOG THE EVENTS THAT TELL THE STORY — every significant action logs one line: auth attempts, records created/updated/deleted, payments started/succeeded/failed, external calls made, jobs run — each with its context: who (user/actor ID), what (operation + key IDs), result, and duration for slow-prone calls; (2) USE LEVELS HONESTLY — error = something failed and needs attention (with the full error and stack), warn = suspicious but survived (retry succeeded, deprecated path used), info = normal significant events; debug noise gets removed before shipping — a log full of 'here 1, here 2' is a log nobody reads; (3) MAKE ERRORS SELF-SUFFICIENT — an error entry must let someone reproduce or locate the issue without you: the operation, the inputs that matter (NEVER passwords, tokens, card numbers — logs are not a place for secrets), the record IDs, and the actual error; (4) MAKE ONE REQUEST TRACEABLE — attach a request/correlation ID at the entry point and carry it through the layers, so one user's failed action can be followed as a single trail instead of guessing which of a thousand lines belong together; (5) LOOK AT THEM — logs only work if consulted: when any bug is investigated, the reflex is logs FIRST, code second; on PM2/[PRIVATE_HOST] setups, know exactly where each app's logs live and check them as step one. The test of good logging: a teammate who wasn't there can answer 'what happened to user X's booking yesterday?' in five minutes, from logs alone. A system that can't tell you what happened forces you to guess — and guessing is where debugging time goes to die.\n\n## Metadata\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #178\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}