Skip to main content

A simple Django app to save logs to database

Project description

DB Logger is a simple Django app to save logs to database.

Quick start

  1. Add “db_logger” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'db_logger',
    ]
    
  2. Run python manage.py migrate to create the polls models.

  3. Add handler and logger to LOGGING setting like this:

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {
            'verbose': {
                'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
                'datefmt': "%d/%b/%Y %H:%M:%S"
            },
            'standard': {
                'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
            },
            'simple': {
                'format': '%(levelname)s %(message)s'
            },
        },
        'handlers': {
            'db_log': {
                'level': 'DEBUG',
                'class': 'db_logger.handlers.DbLogHandler'
            },
        },
        'loggers': {
            '': {
                'handlers': ['db_log'],
                'level': 'DEBUG',
            }
        }
    }
    
  4. Visit /admin/db_logger/dblogentry/ to check the logs.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

db-logger-1.0.tar.gz (3.0 kB view hashes)

Uploaded source

Built Distribution

db_logger-1.0-py3-none-any.whl (4.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page