Middleware that makes a request GUID available from anywhere and injects it into your logs.
Project description
Django GUID attaches a GUID to the local thread of a request. The GUID is accessible from anywhere within the application throughout a request, making it possible to inject the GUID into the logs.
Free software: BSD License
Homepage: https://github.com/JonasKs/django-guid
Documentation: Incoming
Installation
Python package:
pip install django-guid
In your project’s settings.py add these settings:
Add a filter to your LOGGING:
LOGGING = {
'filters': {
'correlation_id': {
'()': 'django_guid_injection.log_filters.CorrelationId'
}
}
}
and put that filter in your handler:
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'medium',
'filters': ['correlation_id'],
}
}
and lastly make sure we add it to the format:
'medium': {
'format': '%(levelname)s %(asctime)s [%(correlation_id)s] %(name)s %(message)s'
}
Inspired by django-log-request-id and django-crequest
2019-12-20
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-guid-0.1.0.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for django_guid-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 722784ec9fc38d88dbb244122c2bc6b486da71258eedee4ec88a5603761fdaba |
|
MD5 | 69f76a203b8b04299b92f6cf827afc92 |
|
BLAKE2b-256 | 7fea14decacbf6ca3678752bdcda9a2dbdf909c959883595f06829354fa2a7bc |