django-user-trace provides a Python logging filter that
injects attributes from the currently logged in Django user.
INFO ... john_doe project.views This is a view log, and should have a user.
INFO ... mike_scott project.views This is a view log, and should have a user.
WARNING ... john_doe project.services.file Some warning in a function!
It uses a ContextVar to store user attributes for use on
the current thread. These are then injected into all log records via a logging
filter.
sequenceDiagram
actor User
User ->>+ django: make request
django ->>+ django.contrib.auth: AuthenticationMiddleware
django.contrib.auth ->>+ django: set `request.user`
django ->>+ django_user_trace: django_user_trace_middleware
note over django, django_user_trace: Capture relevant user attributes into a `ContextVar`
django_user_trace ->>+ django: continue
django --> logging: log message
logging ->>+ django_user_trace: get user attrs
django_user_trace -->> logging: `ContextVar` for user attrs
django ->>+ django_user_trace: signal `request_finished`
note over django, django_user_trace: Clear user attributes from the `ContextVar`
django_user_trace ->>+ django: continue
django -->> User: send response
Supports
Resources
Related Projects
Installation
Install via pip:
pip install django-user-trace
Or, via poetry:
poetry add django-user-trace
Contributing
Thank you for considering contributing to django-user-trace! Please see the
Contribution Guidelines.
Security Vulnerabilities
Please review the Security Policy on how to report security vulnerabilities.
Licence
django-user-trace is open-sourced software licenced under the
MIT licence.
Metadata
Release files for django-user-trace 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_user_trace-2.2.0.tar.gz | 7.8 kB | Without provenance | Details for django_user_trace-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_user_trace-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for django_user_trace-2.2.0-py3-none-any.whl |
Total release size: 19.6 kB
Release files / django_user_trace-2.2.0.tar.gz
| Download URL | django_user_trace-2.2.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e38cd22f92ab4bd9fdfe30ddb77bab1f6b085a3012f2e0a96605761ed227311
|
|
BLAKE2b-256 checksum How to use checksums |
aada92a1aa1eedc96abe22d53866a3afb81bfed047d811fa3e88bf38925ed5f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / django_user_trace-2.2.0-py3-none-any.whl
| Download URL | django_user_trace-2.2.0-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb220005709d3e0beaf7a13412a944c1ace55299215c1ebf4d6048bcf5338ec7
|
|
BLAKE2b-256 checksum How to use checksums |
861f09aec919058d20e5f09dd0ba33eb5bfaff6cb46c9afa460d3ed78ea1ec0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for django-user-trace 2.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.