Skip to main content
# Django Request Log

Simple Django model for logging HttpRequest instances.

**Compatibility:** Python 3.12+ and Django 5.2-6.0

## Why?

We have a number of libraries that store elements of a request (path,
querystring, user, response code, remote_addr, and so on), and it seemed
like time to create a single model that we can use in all of them,
storing a common set of values.

This is not a replacement for web server logs - it's a utility for use
in specific situations where you want to accurately log that someone
requested something.

## How it works

There is a single model, `RequestLog` and a model manager with a
`create` method that can take in a standard `HttpRequest` and / or
`HttpResponse` object and create a new `RequestLog` object. If you
are using this to record view functions, there is also a decorator,
`log_request` that will take care of all this for you:

```python
from request_logger.decorators import log_request

@log_request("downloads")
def download(request: HttpRequest) -> HttpReponse:
return HttpResponse("OK")


@log_request(lambda r: r.user.get_full_name())
def download(request: HttpRequest) -> HttpReponse:
return HttpResponse("OK")
```

The `log_request` argument is mandatory and is used as a "reference",
or category classifier. It can be a str, or a callable which takes
in the request as a single arg.

## Screenshots

**Admin list view**

<img src="screenshots/admin-list.png">

**Admin item view**

<img src="screenshots/admin-edit.png">

Metadata

Release files for django-request-logger-2 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-request-logger-2 0.5.0
File Size Uploaded
django_request_logger_2-0.5.0.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-request-logger-2 0.5.0
File Interpreter ABI Platform
django_request_logger_2-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / django_request_logger_2-0.5.0.tar.gz

Download URL django_request_logger_2-0.5.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a0bcbcdd055f898c65b2f7dadd59fedd7041179c3fc24d63edabd312120c1dcb
BLAKE2b-256 checksum
How to use checksums
88dc0b9508068a35924ff39c0273058bf1e3f0448b706feaa94d3df0c3872f16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / django_request_logger_2-0.5.0-py3-none-any.whl

Download URL django_request_logger_2-0.5.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ecd9bd2c1e6189f27bcb5d1a9bdc1e6114b05a813d0e59195ba67471776a587a
BLAKE2b-256 checksum
How to use checksums
8d2ee99a9c657722c5ff5c036a67fcf94ebbfe2a67df88f2bae01b10f57be2b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4

2 release files

0.3.1

2 release files

0.3

2 release files

0.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page