--- name: "Logging Observability" description: "Enforce structured logging standards and telemetry collection" --- # Skill: Logging Observability ## 1. Purpose Provide tracking logs during production runtime operations to simplify troubleshooting. ## 2. When to Use When writing new controllers, background tasks, or async events. ## 3. Preconditions * Standard JSON logging system instantiated in backend/frontend context. ## 4. Step-by-Step Checklist 1. Instantiate standard logger instances (do not use print statements). 2. Write structured log statements detailing action context. 3. Log exception details under error severity levels. 4. Propagate request correlation IDs through downstream calls. ## 5. Validation Checklist * Logs write in standard JSON format containing execution metadata. * Errors capture clear call stack tracebacks. ## 6. Examples ```python logger.info("creating_booking_initiated", extra={"customer_id": payload.customer_id}) try: db.commit() except Exception as e: logger.exception("creating_booking_failed", extra={"customer_id": payload.customer_id}) raise e ``` ## 7. Failure Cases * Logging plaintext password fields, payment hashes, or personally identifiable information (PII).