Logging records runtime events and diagnostic information so developers can see what a system did. It also gives AI coding assistants concrete execution context when code alone is insufficient. section 11.9.1
A useful pattern logs each major operation’s state and result. Showing that pattern can help an assistant understand program flow and reproduce the same practice in generated code, even before real logs are shared. section 11.9.1
User lookup
A compact pattern records the start and completion of a lookup while preserving a useful result signal: logger.info("Starting user lookup by email", { email }); const user = await findUser(email); logger.info("User lookup complete", { found: !!user }). The same style can be supplied in a prompt when requesting an authentication feature. section 11.9.1
Use logging deliberately when working with AI-generated or AI-connected software:
- Show the assistant which states and events matter before asking it to extend the code. section 11.9.1
- Track function-call input, output, context, initiator, and accessed data in security-sensitive integrations. section 13.4.2
- Avoid exposing sensitive error details to the AI; return generic errors while retaining useful operational records. section 13.4.2







































