A lightweight, beautiful execution time logger middleware for Django REST Framework.
Project description
drf-minimal-api-logger
A lightweight, dependency-free, and beautifully formatted execution time logger middleware for Django and Django REST Framework.
Features
- 🚀 Zero Dependencies — Works out-of-the-box with standard Django, no extra packages needed.
- 🎨 Color-Coded Output — Highlights HTTP statuses: Green for 2xx, Yellow for 4xx, Red for 5xx.
- ⏱️ Performance Tracking — Measures exact request-response lifecycle duration in milliseconds.
Installation
pip install drf-minimal-api-logger
Setup
Add drf_minimal_api_logger to your INSTALLED_APPS and the middleware to MIDDLEWARE in settings.py:
INSTALLED_APPS = [
...
'drf_minimal_api_logger',
]
MIDDLEWARE = [
...
'drf_minimal_api_logger.middleware.MinimalAPILoggerMiddleware',
]
Example Output
[DRF-LOGGER] GET /api/users/ -> 200 (12.34ms)
[DRF-LOGGER] POST /api/login/ -> 400 (5.67ms)
[DRF-LOGGER] DELETE /api/item/1/ -> 500 (3.21ms)
Status codes are color-coded in the terminal:
- Green — 2xx Success
- Yellow — 4xx Client Error
- Red — 5xx Server Error
Requirements
- Python >= 3.8
- Django >= 4.0
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drf_minimal_api_logger-0.1.0.tar.gz.
File metadata
- Download URL: drf_minimal_api_logger-0.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2e8005cce62397917e26df0c95071382c3d9a56a43aa39ec39e58622addfdc5
|
|
| MD5 |
9ff28747fa9809f2622cdf3230da5b8c
|
|
| BLAKE2b-256 |
42122feeb3fba790109f2d13db9aece1331bd65659d39374e439e4da6a02508b
|
File details
Details for the file drf_minimal_api_logger-0.1.0-py3-none-any.whl.
File metadata
- Download URL: drf_minimal_api_logger-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d25055908700d1d4bdb8961b5630b9e286c019cd9d08c86ae4c56111b4706d2
|
|
| MD5 |
47787417c4442361dacb1dfcab499cea
|
|
| BLAKE2b-256 |
0565e8ff0827d4f5974615da19833b2106b8b99dcd6fe62258c477f052c6de1f
|