1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
.. raw:: html
<p align="center">
<h1 align="center">Django GUID</h1>
</p>
<p align="center">
<em>Now with ASGI support!</em>
</p>
.. raw:: html
<p align="center">
<a href="https://pypi.org/pypi/django-guid">
<img src="https://img.shields.io/pypi/v/django-guid.svg" alt="Package version">
</a>
<a href="https://pypi.python.org/pypi/django-guid#downloads">
<img src="https://img.shields.io/badge/python-3.6+-blue.svg" alt="Downloads">
</a>
<a href="https://pypi.python.org/pypi/django-guid">
<img src="https://img.shields.io/badge/django-2.2%20|%203.0%20|%203.1%20-blue.svg" alt="Django versions">
</a>
</a>
<a href="https://img.shields.io/badge/ASGI-supported-brightgreen.svg">
<img src="https://img.shields.io/badge/ASGI-supported-brightgreen.svg" alt="ASGI">
</a>
<a href="https://img.shields.io/badge/WSGI-supported-brightgreen.svg">
<img src="https://img.shields.io/badge/WSGI-supported-brightgreen.svg" alt="WSGI">
</a>
</p>
<p align="center">
<a href="https://django-guid.readthedocs.io/en/latest/?badge=latest">
<img src="https://readthedocs.org/projects/django-guid/badge/?version=latest" alt="Docs">
</a>
<a href="https://codecov.io/gh/snok/django-guid">
<img src="https://codecov.io/gh/snok/django-guid/branch/master/graph/badge.svg" alt="Codecov">
</a>
<a href="https://github.com/psf/black">
<img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Black">
</a>
<a href="https://github.com/pre-commit/pre-commit">
<img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white" alt="Pre-commit">
</a>
</p>
--------------
Django GUID attaches a unique correlation ID/request ID to all your log outputs for every request.
In other words, all logs connected to a request now has a unique ID attached to it, making debugging simple.
Which version of Django GUID you should use depends on your Django version and whether you run ``ASGI`` or ``WSGI`` servers.
To determine which Django-GUID version you should use, please see the table below.
+---------------------+--------------------------+
| Django version | Django-GUID version |
+=====================+==========================+
| 3.1.1 or above | 3.x.x - ASGI and WSGI |
+---------------------+--------------------------+
| 3.0.0 - 3.1.0 | 2.x.x - Only WSGI |
+---------------------+--------------------------+
| 2.2.x | 2.x.x - Only WSGI |
+---------------------+--------------------------+
Django GUID >= 3.0.0 uses ``ContextVar`` to store and access the GUID. Previous versions stored the GUID to an object,
making it accessible by using the ID of the current thread.
--------------
**Resources**:
* Free software: BSD License
* Documentation: https://django-guid.readthedocs.io
* Homepage: https://github.com/snok/django-guid
--------------
**Examples**
Log output with a GUID:
.. code-block:: bbcode
INFO ... [773fa6885e03493498077a273d1b7f2d] project.views This is a DRF view log, and should have a GUID.
WARNING ... [773fa6885e03493498077a273d1b7f2d] project.services.file Some warning in a function
INFO ... [0d1c3919e46e4cd2b2f4ac9a187a8ea1] project.views This is a DRF view log, and should have a GUID.
INFO ... [99d44111e9174c5a9494275aa7f28858] project.views This is a DRF view log, and should have a GUID.
WARNING ... [0d1c3919e46e4cd2b2f4ac9a187a8ea1] project.services.file Some warning in a function
WARNING ... [99d44111e9174c5a9494275aa7f28858] project.services.file Some warning in a function
Log output without a GUID:
.. code-block:: text
INFO ... project.views This is a DRF view log, and should have a GUID.
WARNING ... project.services.file Some warning in a function
INFO ... project.views This is a DRF view log, and should have a GUID.
INFO ... project.views This is a DRF view log, and should have a GUID.
WARNING ... project.services.file Some warning in a function
WARNING ... project.services.file Some warning in a function
--------------
Contents
--------
.. toctree::
:maxdepth: 3
install
configuration
settings
api
integrations
extended_example
troubleshooting
upgrading
publish
changelog
|