Logger for the logging module that writes messages to the database
Project description
django-logging-eventlog
Logger for the logging module that writes messages to the django database
Installation
Install using pip:
pip install --upgrade django-logging-eventlog
Modify your settings.py. Add eventlog to your INSTALLED_APPS:
INSTALLED_APPS = [ #django apps 'eventlog', #your apps ]Configure LOGGING in your settings.py for example:
LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'eventlog': { 'class': 'eventlog.services.EventLogHandler' }, 'console': { 'class': 'logging.StreamHandler', }, }, 'loggers': { 'root': { 'handlers': ['console', 'eventlog'], 'level': 'INFO', 'propagate': True, }, } }Run python manage.py makemigrations eventlog and run Run python manage.py migrate
Usage
import logging
logger = logging.getLogger(__name__)
logger.info('info')
logger.debug('debug')
logger.error('error')
logger.critical('critical')
logger.warning('warning')
try:
1/0
except Exception as ex:
logger.exception(ex, exc_info=ex)
To prune the eventlog, use the command as pruneeventlog. For example, to keep records in the database only for the last 30 days, run:
python manage.py pruneeventlog 30
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-logging-eventlog-0.0.4.tar.gz.
File metadata
- Download URL: django-logging-eventlog-0.0.4.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
685d47f63c24c6d3719e966287399891a03e6d99eefcea0de8d856f3a6c9b239
|
|
| MD5 |
19762a28389635967c8ef14d26e149bc
|
|
| BLAKE2b-256 |
d79e26068721ac334105f7dc0acbedb3dd97df556773332d7b78e85449849391
|
File details
Details for the file django_logging_eventlog-0.0.4-py3-none-any.whl.
File metadata
- Download URL: django_logging_eventlog-0.0.4-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7ab0ddb65cc2d70e4784a5c9d86fc7cfa97e231bd32709599c848b5cbe943e8
|
|
| MD5 |
e52812c59624ca7eae530039d72a0d1c
|
|
| BLAKE2b-256 |
201559282e07f4bfe3772e0c8ba42507648e355f1d3f58ab2d94ac0da98e50c7
|