Logger for the logging module that writes messages to the database
Project description
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 your LOGGING for example:
LOGGING = {
‘version’: 1, ‘disable_existing_loggers’: False, ‘handlers’: {
‘eventlog’: {
‘class’: ‘eventlog.services.EventLogHandler’
},
},
‘loggers’: {
‘console’: {
‘class’: ‘logging.StreamHandler’,
},
‘file’: {
‘class’: ‘logging.handlers.FileHandler’, ‘filename’: ‘app.log’,
},
‘root’: {
‘handlers’: [‘file’, ‘console’, ‘eventlog’], ‘level’: ‘INFO’,
},
‘eventlog’: {
‘handlers’: [‘eventlog’, ], ‘level’: ‘INFO’,
},
}
}
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)
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
Hashes for django-logging-eventlog-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa31b025645ee53cee7b063f741da855601bce90658893fcc08bf395d2d3f031 |
|
MD5 | 31841bb7aaa65e21f00344f033f97675 |
|
BLAKE2b-256 | 0481427ed3f7e6868b7897fd4d13199eb7510ad7f475b02d73748737cbd99b2d |
Hashes for django_logging_eventlog-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39783e613e398bc4a584ae707eda3f0a4fa460c244b66f804a40d41dfd8262c6 |
|
MD5 | 1b3228f47ca108e2d543fe3a91c29d27 |
|
BLAKE2b-256 | 80dead9f04489b29e5c46bc8a44f707b08bd50d0fd18e746eda46410e7b7e2a3 |