Skip to main content

Django logging in database

Project description

https://travis-ci.org/CiCiUi/django-db-logger.svg?branch=master

Django logging in database. For large projects please use Sentry

Screenshot

https://ciciui.github.io/django-db-logger/static/img/django-db-logger.png

Dependency

  • Django>=1.6

  • Python 2.6+/3.3+

License

MIT

Quick start

  1. Install

pip install django-db-logger
  1. Add “django_db_logger” to your INSTALLED_APPS setting like this

INSTALLED_APPS = (
    ...
    'django_db_logger',
)
  1. Add handler and logger to LOGGING setting like this

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 %(asctime)s %(message)s'
        },
    },
    'handlers': {
        'db_log': {
            'level': 'DEBUG',
            'class': 'django_db_logger.db_log_handler.DatabaseLogHandler'
        },
    },
    'loggers': {
        'db': {
            'handlers': ['db_log'],
            'level': 'DEBUG'
        }
    }
}
  1. Run python manage.py migrate to create django-db-logger models.

  2. Use django-db-logger like this

import logging
db_logger = logging.getLogger('db')

db_logger.info('info message')
db_logger.warning('warning message')

try:
    1/0
except Exception as e:
    db_logger.exception(e)

Options

  1. DJANGO_DB_LOGGER_ADMIN_LIST_PER_PAGE: integer. list per page in admin view. default 10

  2. DJANGO_DB_LOGGER_ENABLE_FORMATTER: boolean. Using formatter options to format message.``True`` or False, default False

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-db-logger-0.1.8rc1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

django_db_logger-0.1.8rc1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file django-db-logger-0.1.8rc1.tar.gz.

File metadata

  • Download URL: django-db-logger-0.1.8rc1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for django-db-logger-0.1.8rc1.tar.gz
Algorithm Hash digest
SHA256 064b04be0e204d2c84e2ab1c10c2a4ebb6247020ee540de24f3b5ecdf68f72ef
MD5 60b9984c16fd9a6447e48d0b494f6c07
BLAKE2b-256 c070d2c203a28afab609e9fd113a6aaf419129aefcdced6efa1b34ad21462d66

See more details on using hashes here.

File details

Details for the file django_db_logger-0.1.8rc1-py3-none-any.whl.

File metadata

  • Download URL: django_db_logger-0.1.8rc1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for django_db_logger-0.1.8rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca7a9f3b25fbb6b78800d5ba571bae65ec28ca2ee942ed5a5c2aacd54937fc24
MD5 bafd32eeded7ec00bf2b44bece75f382
BLAKE2b-256 9a9df0b90ca1ef407ce37eaf3ff1766a91d22372154c5ab794998fdbfe911892

See more details on using hashes here.

Supported by

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