Drf Tracking

screenshot of Drf Tracking

Utils to track requests to Django Rest Framework API views

Overview

The drf-tracking library is an essential tool for developers working with Django Rest Framework (DRF), providing a seamless way to log API requests and responses directly into a database. This functionality is particularly useful for monitoring application performance and debugging. With its simple integration into existing DRF views, developers can easily track the various attributes of each request, helping to maintain an efficient and reliable application.

Incorporating drf-tracking into a project allows for enhanced logging capabilities without altering the core functionality of existing views. The library supports a range of Django and Python versions, making it versatile for various project setups. By using this package, teams can gain valuable insights into user interactions, which can lead to improved application performance and user experience.

Features

  • Comprehensive Logging: Automatically logs user information, request timings, IP addresses, and more, providing a complete picture of API interactions.
  • Flexibility: Easily add the LoggingMixin to any DRF view to create logs for API requests without significant modification.
  • Custom Logging Rules: Override methods like should_log to set specific conditions under which requests are logged, enhancing control over what data is captured.
  • Performance Optimization: Opt to log only certain HTTP methods with the logging_methods attribute, preventing unnecessary overhead.
  • Custom Handling: Modify the log-saving process by overriding the handle_log method, allowing storage in alternative ways such as in-memory or through external logging systems.
  • Compatibility: Supports multiple versions of Django and Python, ensuring integration with various project setups is smooth.
  • Easy Installation: Simple to install via pip and integrate into existing Django projects with minimal setup.