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.4.tar.gz
(2.1 kB
view details)
Built Distribution
File details
Details for the file django-logit-1.0.4.tar.gz
.
File metadata
- Download URL: django-logit-1.0.4.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac53f25ba3861cf005a70bf6b11d6eda4276b98534c4ad58a25167fbc3d64d8c |
|
MD5 | 829073c00096e7ddc40d0449a2b639e6 |
|
BLAKE2b-256 | 351316515ed58f6a478a0b970dcc6b8524b944208f8604df19b9d28e9cff9ec6 |
File details
Details for the file django_logit-1.0.4-py2.py3-none-any.whl
.
File metadata
- Download URL: django_logit-1.0.4-py2.py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19146306e99fa92bdd4565634dca75d918ab99439e8a26aff3295ee9cb2ac1c2 |
|
MD5 | ac4e5ee7657f213fc1701aba3bea7142 |
|
BLAKE2b-256 | 605cd6236b7fc37862db0c3482e0b807cfc75259db60d80b3edbb3f8bd03fc81 |