backend-logging

Emit one enriched log entry per HTTP request in FastAPI services.

5|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/agusmdev/fullstack-ai-template --skill backend-logging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-logging
Source: https://github.com/agusmdev/fullstack-ai-template/tree/main/template/.pi/skills/backend-logging
Command: npx skills add https://github.com/agusmdev/fullstack-ai-template --skill backend-logging

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The backend logging system ensures every HTTP request yields a single, richly contextual log entry, simplifying debugging and observability across services.

Core Features & Use Cases

  • WideEventMiddleware emits one canonical log per request after completion, enriched with method, path, status, duration, and context.
  • log helpers (log_action, log_entity, log_entities, log_custom, log_user) provide structured, consistent context tagging for handlers and services.
  • Use cases include debugging request flows, auditing user actions, and monitoring performance with automatic sanitization of sensitive data.

Quick Start

Implement end-to-end structured logging in FastAPI apps by wiring WideEventMiddleware and log helpers in your routes.

Frequently Asked Questions about backend-logging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement structured logging for HTTP requests in FastAPI?

Structured logging for HTTP requests in FastAPI is implemented by wiring WideEventMiddleware to emit a single, enriched log entry per request containing method, path, status, and duration. This ensures deterministic emission and clear observability across services.

What is a wide event log entry and when do I need it for backend observability?

A wide event log entry is a single, richly contextual record emitted after an HTTP request completes. You need it for backend observability when debugging request flows, auditing user actions, or monitoring performance across distributed services.

Can I sanitize sensitive data automatically when logging request flows?

Yes, sensitive data is sanitized automatically during log reporting. The logging helpers enforce safe log reporting with configurable formats, ensuring contextual accumulation without exposing sensitive information in the final structured logs.

Does this structured logging approach work with FastAPI middleware?

Yes, this approach works seamlessly with FastAPI middleware. The WideEventMiddleware integrates directly into the middleware stack to produce canonical logs, while helpers like log_action and log_entity provide consistent context tagging for handlers.

What's the best way to audit user actions in backend services?

The best way to audit user actions in backend services is using structured log helpers like log_user and log_action. These provide consistent context tagging for handlers and services, yielding a single enriched log entry for clear observability and auditing.