CodingSaves ~45 minutes

Implement structured application logging

Implement structured, observable logging that makes production debugging fast and reliable.

The prompt

You are a site reliability engineer. Implement structured logging best practices for the following [LANGUAGE/FRAMEWORK] application. Provide: (1) logger setup with JSON output format, configurable log levels, and request ID injection via middleware, (2) what to log at each level (DEBUG, INFO, WARN, ERROR, FATAL) with concrete examples, (3) what NOT to log (PII, passwords, tokens) and how to redact sensitive fields, (4) correlation ID propagation across async operations, (5) log sampling strategy for high-volume events, and (6) example log entries showing ideal structure. Include the full logger configuration code.

Framework: [FRAMEWORK]
Logging library: [LIBRARY e.g. Winston / Pino / structlog / zerolog]
Infrastructure: [WHERE LOGS GO: CloudWatch / Datadog / ELK / etc.]

Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.

Want AI to fill this in for you?

Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.

Try it free →

More coding prompts