Django Decorator of Logging Request Params
Project description
Django Decorator of Logging Request Params
Installation
pip install django-logit
Usage
from logit import logit @logit def xxx(request): xxx
Settings.py
# logger setting LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' }, 'simple': { 'format': '%(levelname)s %(message)s' }, }, 'handlers': { 'logit': { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'filename': '/tmp/logit.log', 'formatter': 'verbose' }, }, 'loggers': { 'logit': { 'handlers': ['logit'], 'level': 'DEBUG', 'propagate': True, }, }, } Use RotatingFileHandler to support rotation of disk log files. LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' }, 'simple': { 'format': '%(levelname)s %(message)s' }, }, 'handlers': { 'logit': { 'level': 'DEBUG', 'class': 'logging.handlers.RotatingFileHandler', 'filename': '/tmp/logit.log', 'maxBytes': 15728640, # 1024 * 1024 * 15B = 15MB 'backupCount': 10, 'formatter': 'verbose', }, }, 'loggers': { 'logit': { 'handlers': ['logit'], 'level': 'DEBUG', 'propagate': True, }, }, } Use TimedRotatingFileHandler to support rotation of disk log files at certain timed intervals. LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' }, 'simple': { 'format': '%(levelname)s %(message)s' }, }, 'handlers': { 'logit': { 'level': 'DEBUG', 'class': 'logging.handlers.TimedRotatingFileHandler', 'filename': '/tmp/logit.log', 'when': 'midnight', 'backupCount': 10, 'formatter': 'verbose', }, }, 'loggers': { 'logit': { 'handlers': ['logit'], 'level': 'DEBUG', 'propagate': True, }, }, }
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-logit-1.0.2.tar.gz
(1.8 kB
view details)
Built Distribution
File details
Details for the file django-logit-1.0.2.tar.gz
.
File metadata
- Download URL: django-logit-1.0.2.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6bff4b10ce0d7180902f5e05e3d7d4bd5a6984d5000e2c7c441d160c2c55e4e |
|
MD5 | fb626dc08fe1dd111a8d6c1a09a55ce9 |
|
BLAKE2b-256 | c50b7490f3101d3470c4b0dda2a0089c861627052d2b0c686b88caf616f5bdc5 |
Provenance
File details
Details for the file django_logit-1.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: django_logit-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb70544ec780a05e48d38ac0f5ba7cba74d0bd212bac4418591afecc68c8d3cf |
|
MD5 | f66e42470d7541802dad0a00a11dfb71 |
|
BLAKE2b-256 | 17b80d4b068fc343cf60ae24919fa9e81e86092db48fcb4522d7e79161ecd893 |