diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-10 07:42:29 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-10 07:42:29 +0000 |
| commit | 1bc07c8aa3b2ac7eb2d3f0198a98965029f7a731 (patch) | |
| tree | fe7dc8e6ce2b0cf95eeec654ae0b4da496506c59 | |
| parent | 228c169d1722f4d9dde6b8740d03dea8b3a28ed9 (diff) | |
automatic import of python-request-id-django-log
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-request-id-django-log.spec | 303 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 305 insertions, 0 deletions
@@ -0,0 +1 @@ +/request_id_django_log-0.2.0.tar.gz diff --git a/python-request-id-django-log.spec b/python-request-id-django-log.spec new file mode 100644 index 0000000..43b072e --- /dev/null +++ b/python-request-id-django-log.spec @@ -0,0 +1,303 @@ +%global _empty_manifest_terminate_build 0 +Name: python-request-id-django-log +Version: 0.2.0 +Release: 1 +Summary: A simple way to implement request_id in Django +License: MIT +URL: https://github.com/juntossomosmais/request-id-django-log +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/d9/96/24c893dca377a8525f0e38d32211fb8887a66f3b8ccdf7fc91f298a81c97/request_id_django_log-0.2.0.tar.gz +BuildArch: noarch + + +%description +# Request ID Django Log + +[](https://travis-ci.com/juntossomosmais/request-id-django-log) [](https://codeclimate.com/github/juntossomosmais/request-id-django-log/maintainability) [](https://codeclimate.com/github/juntossomosmais/request-id-django-log/test_coverage) [](https://coveralls.io/github/juntossomosmais/request-id-django-log?branch=master) [](https://badge.fury.io/py/request-id-django-log) [](https://github.com/ambv/black) [](https://pepy.tech/project/request-id-django-log) [](https://pepy.tech/project/request-id-django-log) [](https://pepy.tech/project/request-id-django-log) + [](https://saythanks.io/to/ricardochaves) + +## Install + +`pip install request-id-django-log` + +Update your `INSTALLED_APPS` and `MIDDLEWARE` +```python +INSTALLED_APPS = [ + ... + "request_id_django_log", +] +``` + +```python +MIDDLEWARE = [ + ... + "request_id_django_log.middleware.RequestIdDjangoLog", +] +``` + +## Configure + +The following options are used by this library: + +```python +REQUEST_ID_CONFIG = { + "REQUEST_ID_HEADER": "HTTP_X_REQUEST_ID", + "GENERATE_REQUEST_ID_IF_NOT_FOUND": True, + "RESPONSE_HEADER_REQUEST_ID": "HTTP_X_REQUEST_ID", +} +``` + +- `REQUEST_ID_HEADER` is the header name which will hold the received request_id. This must be used when another system is responsible for generating the request_ids and sending them to your django application. +- `GENERATE_REQUEST_ID_IF_NOT_FOUND` If set to true, a new request_id will be generated if none was previously supplied. +- `RESPONSE_HEADER_REQUEST_ID` sets the name of the response header which will hold the value of the request_id. + +With this configuration if the request have the header `X-REQUEST-ID` the library will use this header value. + +## Logs + +If you want your logs to have the request id, add the following lines to your logging dictionary configuration: + +```python +LOGGING = { + ... + "filters": {"request_id": {"()": "request_id_django_log.filters.RequestIDFilter"}}, + "formatters": { + "standard": { + ... + "format": "%(levelname)-8s [%(asctime)s] [%(request_id)s] %(name)s: %(message)s", + }, + ... + }, + "handlers": { + "console": { + ... + "filters": ["request_id"], + ... + } + }, + "loggers": { + "": {"level": "INFO", "handlers": ["console"]}, + ... + }, +} +``` + +## Supported Versions + +- `python 2.7` with Django `1.8`, `1.9` and `1.11` +- `python 3.5`, `3.6` and `3.7` with Django `1.8`, `1.9`, `1.11`, `2.0`, `2.1`, `2.2` and `3.0` + + + + +%package -n python3-request-id-django-log +Summary: A simple way to implement request_id in Django +Provides: python-request-id-django-log +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-request-id-django-log +# Request ID Django Log + +[](https://travis-ci.com/juntossomosmais/request-id-django-log) [](https://codeclimate.com/github/juntossomosmais/request-id-django-log/maintainability) [](https://codeclimate.com/github/juntossomosmais/request-id-django-log/test_coverage) [](https://coveralls.io/github/juntossomosmais/request-id-django-log?branch=master) [](https://badge.fury.io/py/request-id-django-log) [](https://github.com/ambv/black) [](https://pepy.tech/project/request-id-django-log) [](https://pepy.tech/project/request-id-django-log) [](https://pepy.tech/project/request-id-django-log) + [](https://saythanks.io/to/ricardochaves) + +## Install + +`pip install request-id-django-log` + +Update your `INSTALLED_APPS` and `MIDDLEWARE` +```python +INSTALLED_APPS = [ + ... + "request_id_django_log", +] +``` + +```python +MIDDLEWARE = [ + ... + "request_id_django_log.middleware.RequestIdDjangoLog", +] +``` + +## Configure + +The following options are used by this library: + +```python +REQUEST_ID_CONFIG = { + "REQUEST_ID_HEADER": "HTTP_X_REQUEST_ID", + "GENERATE_REQUEST_ID_IF_NOT_FOUND": True, + "RESPONSE_HEADER_REQUEST_ID": "HTTP_X_REQUEST_ID", +} +``` + +- `REQUEST_ID_HEADER` is the header name which will hold the received request_id. This must be used when another system is responsible for generating the request_ids and sending them to your django application. +- `GENERATE_REQUEST_ID_IF_NOT_FOUND` If set to true, a new request_id will be generated if none was previously supplied. +- `RESPONSE_HEADER_REQUEST_ID` sets the name of the response header which will hold the value of the request_id. + +With this configuration if the request have the header `X-REQUEST-ID` the library will use this header value. + +## Logs + +If you want your logs to have the request id, add the following lines to your logging dictionary configuration: + +```python +LOGGING = { + ... + "filters": {"request_id": {"()": "request_id_django_log.filters.RequestIDFilter"}}, + "formatters": { + "standard": { + ... + "format": "%(levelname)-8s [%(asctime)s] [%(request_id)s] %(name)s: %(message)s", + }, + ... + }, + "handlers": { + "console": { + ... + "filters": ["request_id"], + ... + } + }, + "loggers": { + "": {"level": "INFO", "handlers": ["console"]}, + ... + }, +} +``` + +## Supported Versions + +- `python 2.7` with Django `1.8`, `1.9` and `1.11` +- `python 3.5`, `3.6` and `3.7` with Django `1.8`, `1.9`, `1.11`, `2.0`, `2.1`, `2.2` and `3.0` + + + + +%package help +Summary: Development documents and examples for request-id-django-log +Provides: python3-request-id-django-log-doc +%description help +# Request ID Django Log + +[](https://travis-ci.com/juntossomosmais/request-id-django-log) [](https://codeclimate.com/github/juntossomosmais/request-id-django-log/maintainability) [](https://codeclimate.com/github/juntossomosmais/request-id-django-log/test_coverage) [](https://coveralls.io/github/juntossomosmais/request-id-django-log?branch=master) [](https://badge.fury.io/py/request-id-django-log) [](https://github.com/ambv/black) [](https://pepy.tech/project/request-id-django-log) [](https://pepy.tech/project/request-id-django-log) [](https://pepy.tech/project/request-id-django-log) + [](https://saythanks.io/to/ricardochaves) + +## Install + +`pip install request-id-django-log` + +Update your `INSTALLED_APPS` and `MIDDLEWARE` +```python +INSTALLED_APPS = [ + ... + "request_id_django_log", +] +``` + +```python +MIDDLEWARE = [ + ... + "request_id_django_log.middleware.RequestIdDjangoLog", +] +``` + +## Configure + +The following options are used by this library: + +```python +REQUEST_ID_CONFIG = { + "REQUEST_ID_HEADER": "HTTP_X_REQUEST_ID", + "GENERATE_REQUEST_ID_IF_NOT_FOUND": True, + "RESPONSE_HEADER_REQUEST_ID": "HTTP_X_REQUEST_ID", +} +``` + +- `REQUEST_ID_HEADER` is the header name which will hold the received request_id. This must be used when another system is responsible for generating the request_ids and sending them to your django application. +- `GENERATE_REQUEST_ID_IF_NOT_FOUND` If set to true, a new request_id will be generated if none was previously supplied. +- `RESPONSE_HEADER_REQUEST_ID` sets the name of the response header which will hold the value of the request_id. + +With this configuration if the request have the header `X-REQUEST-ID` the library will use this header value. + +## Logs + +If you want your logs to have the request id, add the following lines to your logging dictionary configuration: + +```python +LOGGING = { + ... + "filters": {"request_id": {"()": "request_id_django_log.filters.RequestIDFilter"}}, + "formatters": { + "standard": { + ... + "format": "%(levelname)-8s [%(asctime)s] [%(request_id)s] %(name)s: %(message)s", + }, + ... + }, + "handlers": { + "console": { + ... + "filters": ["request_id"], + ... + } + }, + "loggers": { + "": {"level": "INFO", "handlers": ["console"]}, + ... + }, +} +``` + +## Supported Versions + +- `python 2.7` with Django `1.8`, `1.9` and `1.11` +- `python 3.5`, `3.6` and `3.7` with Django `1.8`, `1.9`, `1.11`, `2.0`, `2.1`, `2.2` and `3.0` + + + + +%prep +%autosetup -n request-id-django-log-0.2.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-request-id-django-log -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.0-1 +- Package Spec generated @@ -0,0 +1 @@ +85973ea62aacdcf12cb3b6ff62ab22ec request_id_django_log-0.2.0.tar.gz |
