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.3.tar.gz
(2.1 kB
view details)
Built Distribution
File details
Details for the file django-logit-1.0.3.tar.gz
.
File metadata
- Download URL: django-logit-1.0.3.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84fe9e72ccf4f90009ce27224f318ce11d109fa70e1a76ee6a203a8df38521f2 |
|
MD5 | 328e8c5e28b1d736686f3a366a0b0880 |
|
BLAKE2b-256 | a7f1dc235571b517133d90833929540548bba29867647f3362357b2e7d5f519d |
Provenance
File details
Details for the file django_logit-1.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: django_logit-1.0.3-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 | ac053f3e79d5f7fcd6e060213299bab74b27b611292725985da6c7d7963e2d8b |
|
MD5 | 29854cb8ab4500dfa15789ab2928340d |
|
BLAKE2b-256 | 50859ee65e27d1c3cf40b55a224f522190ccfc157c71a48826963303f137fcf9 |