Set of utilities for better logging in WSGI applications
Project description
Kudzu provides WSGI middleware and logging handlers which:
Read or generate unique ID for each request and include this request ID in emitted log records.
Sends request ID in response using X-Request-ID header. This ID is also made globally available and can included when calling other applications or components.
Logs all requests and responses using Python standard logging.
Kudzu is framework independent and it is compatible with both Python 2 (tested with 2.6 and 2.7) and Python 3 (tested with 3.3 and 3.4).
Installation
Kudzu can be installed using pip (or easy_install) from PyPI:
$ pip install kudzu
Alternatively you can download and extract tarball and install the package manually:
$ python setup.py install
Placing the package to your PYTHONPATH should also work.
Example usage
# Apply middleware to WSGI application application = kudzify_app(application) # Include request ID and remote address in log records kudzify_logger(format='[%(addr)s|%(rid)s] %(levelname)s:%(message)s')
See example.py for more information.
Testing
Tests for all supported Python versions can be run using Tox:
$ tox
Alternativelly you can install Kudzu with test dependencies pytest and Werkzeug and run tests manually:
$ py.test
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
File details
Details for the file Kudzu-0.1.tar.gz
.
File metadata
- Download URL: Kudzu-0.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3659e8d08a9db6606a5da43cf7cc502d498fc1c1c8de77c2850ea2ff258aa43 |
|
MD5 | 456ce87d1295e738b1d80da309167698 |
|
BLAKE2b-256 | ca7f00ac678b7f98a0129eee77704e66a9dd1c72724284060541cf70b1c7827d |