@@ -185,6 +185,47 @@ try {
185185- Include context (user ID, operation) in log messages
186186- Use appropriate levels: ` error ` , ` warn ` , ` info ` , ` debug `
187187
188+ ### Edge Function Logging (Deno)
189+
190+ ** Use the shared structured logger instead of raw console.log:**
191+
192+ ``` typescript
193+ import { createLogger } from " ../_shared/logger.ts" ;
194+
195+ const logger = createLogger (" service-name" );
196+
197+ // Structured JSON logging with context
198+ logger .debug (" Debug information" , { userId: " 123" });
199+ logger .info (" Operation completed" , { userId: " 123" , duration: 150 });
200+ logger .warn (" Unexpected state" , { details: context });
201+ logger .error (" Operation failed" , { error: error .message });
202+ ```
203+
204+ ** Best Practices:**
205+
206+ - Output structured JSON for log aggregators (CloudWatch, Datadog)
207+ - Control verbosity with ` LOG_LEVEL ` environment variable
208+ - Use English only for developer/operator logs (not user-facing)
209+ - Always include relevant context (user ID, operation, IDs)
210+ - Never log sensitive data (passwords, tokens, PII)
211+ - Use appropriate levels:
212+ - ` debug ` : Development-only, detailed troubleshooting
213+ - ` info ` : Operational events (token refresh, email sent)
214+ - ` warn ` : Recoverable issues, unexpected states
215+ - ` error ` : Failures requiring attention
216+
217+ ** Example Output:**
218+
219+ ``` json
220+ {
221+ "timestamp" : " 2026-03-02T14:30:00.000Z" ,
222+ "service" : " email-campaigns" ,
223+ "level" : " info" ,
224+ "message" : " OAuth token refreshed" ,
225+ "email" : " user@example.com"
226+ }
227+ ```
228+
188229### Testing
189230
190231- ** Jest** for backend and emails-fetcher
@@ -223,3 +264,24 @@ try {
223264- Node.js >= 20.0.0 required
224265- Bun >= 1.1.0 required for emails-fetcher
225266- Docker and Docker Compose required for local dev
267+
268+ ## Planning Documents
269+
270+ ### docs/plans Directory
271+
272+ The ` docs/plans/ ` directory contains local planning documents and implementation notes created during development. These files:
273+
274+ - ** Should NOT be pushed to the remote repository**
275+ - Are meant for local development reference only
276+ - Help track implementation details and decisions
277+
278+ If you create plan documents in ` docs/plans/ ` , they should remain local to your machine and not be shared with the team through git.
279+
280+ ### Creating Plan Documents
281+
282+ When creating implementation plans:
283+
284+ 1 . Save them to ` docs/plans/YYYY-MM-DD-<feature-name>.md `
285+ 2 . Keep them local - do not commit to git
286+ 3 . Use them for local reference during development
287+ 4 . Delete them once the feature is complete if desired
0 commit comments