It logs all the API information for content type "application/json".
- status
- api
- method
- headers
- client_ip_address
- client_ip_geolocation
- response
- status_code
- execution_time
- user_agent
- added_on
- PyPI
pip install django-log-tracker
- Install requests
pip install requests
- Add "django_log_tracker" to your INSTALLED_APPS setting like this
INSTALLED_APPS = [
...,
'django_log_tracker',
]
- Add in MIDDLEWARE
MIDDLEWARE = [
...,
'django_log_tracker.middleware.log_tracker_middleware.LogTrackerMiddleware',
]
- Run
python manage.py migrate
Log every request into the database.
DJANGO_LOG_TRACKER_DATABASE = True # Default to False
- Logs will be available in Django Admin Panel.
- The search bar will search in Request Body, Response, Headers and API URL.
- You can also filter the logs based on the "added_on" date, Status Code and Request Methods.
DJANGO_LOG_TRACKER_IP = True # Default to False
DJANGO_LOG_TRACKER_IP_GEOLOCATION = True # Default to False
API response may get slower for DJANGO_LOG_TRACKER_IP and DJANGO_LOG_TRACKER_IP_GEOLOCATION. So by default they both are false.
>>> import django_log_tracker
>>> django_log_tracker.__version__