The logger middleware automatically logs all incoming HTTP requests with detailed information including method, URL, status code, and response time.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/juanjh1/asimilation/llms.txt
Use this file to discover all available pages before exploring further.
What It Does
The logger middleware:- Captures request start time
- Logs request details when the response completes
- Displays color-coded status codes in the console
- Measures and reports response time in milliseconds
- Uses the
chalklibrary for colored output
Log Format
Each log entry follows this format:Color Coding
Status codes are color-coded for easy identification:- Green (2xx): Successful responses
- Blue (3xx): Redirects
- Magenta (4xx): Client errors
- Red (5xx): Server errors
- Yellow (1xx): Informational
- Gray: Unknown status codes
How It Works
The logger middleware is automatically registered with theMiddlewarePipeline when imported. Here’s the implementation:
Key Features
The middleware attaches to the request’s
end event, ensuring logs are only written after the response is fully sent.Enabling the Logger
The logger middleware is part of the default middleware stack. To enable it, simply import it in your application:Example Output
When running your application, you’ll see colored logs in the console:The logger middleware runs for all requests and cannot be disabled per-route. If you need conditional logging, consider creating a custom middleware.
Use Cases
- Development: Monitor API requests in real-time during development
- Debugging: Identify slow endpoints by checking response times
- Monitoring: Track request patterns and error rates
- Performance: Analyze response times to optimize slow routes

