provide http api for use of logging.handlers.HTTPHandler
save messages into db by asynchoronous,use celery
Quick start
Add “polls” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = ( ... 'django_http_logs', )Include the polls URLconf in your project urls.py like this:
url(r'logs/', include('django_logs.urls')),Run python manage.py migrate to create the http logs models.
Run python manage.py runserver 0.0.0.0:8080 and run celery worker(config celery self)
Start use http logging:
import time from logging.handlers import HTTPHandler logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) host = '127.0.0.1:8080' # django run port url = '/logs/apis/' handler = HTTPHandler(host, url, method='POST') logger.addHandler(handler) logger.debug("hello world")Visit http://127.0.0.1:8080/admin to participate in the django_logs.
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 django-http-logs-1.0.8.tar.gz.
File metadata
- Download URL: django-http-logs-1.0.8.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
Python-urllib/3.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
045dbfd2487a9c6d4480f7ff7284836cf8212e91fec776524c23c5da28dc4e74
|
|
| MD5 |
98d6c6c5738ef67638be1eaf23f9c678
|
|
| BLAKE2b-256 |
720add94b85fdf645c6a59b65b069738f7a9d01baa9ec381c8e7d889a18e4801
|