Skip to main content

Logger for the logging module that writes messages to the database

Project description

License Python version Django version

django-logging-eventlog

Logger for the logging module that writes messages to the django database

http://www.mnemchinov.ru/images/projects/django-logging-eventlog/eventlog_events.jpg http://www.mnemchinov.ru/images/projects/django-logging-eventlog/eventlog_event_exception.jpg

Installation

  1. Install using pip:

    pip install --upgrade django-logging-eventlog
  2. Modify your settings.py. Add eventlog to your INSTALLED_APPS:

    INSTALLED_APPS = [
        #django apps
        'eventlog',
        #your apps
    ]
  3. 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,
            },
        }
    }
  4. 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

django-logging-eventlog-0.0.4.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_logging_eventlog-0.0.4-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

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

Hashes for django-logging-eventlog-0.0.4.tar.gz
Algorithm Hash digest
SHA256 685d47f63c24c6d3719e966287399891a03e6d99eefcea0de8d856f3a6c9b239
MD5 19762a28389635967c8ef14d26e149bc
BLAKE2b-256 d79e26068721ac334105f7dc0acbedb3dd97df556773332d7b78e85449849391

See more details on using hashes here.

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

Hashes for django_logging_eventlog-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f7ab0ddb65cc2d70e4784a5c9d86fc7cfa97e231bd32709599c848b5cbe943e8
MD5 e52812c59624ca7eae530039d72a0d1c
BLAKE2b-256 201559282e07f4bfe3772e0c8ba42507648e355f1d3f58ab2d94ac0da98e50c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page