Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drf_minimal_api_logger-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drf_minimal_api_logger-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

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

Hashes for drf_minimal_api_logger-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b2e8005cce62397917e26df0c95071382c3d9a56a43aa39ec39e58622addfdc5
MD5 9ff28747fa9809f2622cdf3230da5b8c
BLAKE2b-256 42122feeb3fba790109f2d13db9aece1331bd65659d39374e439e4da6a02508b

See more details on using hashes here.

File details

Details for the file drf_minimal_api_logger-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for drf_minimal_api_logger-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d25055908700d1d4bdb8961b5630b9e286c019cd9d08c86ae4c56111b4706d2
MD5 47787417c4442361dacb1dfcab499cea
BLAKE2b-256 0565e8ff0827d4f5974615da19833b2106b8b99dcd6fe62258c477f052c6de1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page