Skip to main content

Log http errors or custom logs with loguru library into db

Project description

Django модуль для логирования ошибок в базу данных

Модуль создан для удобства просмотра логов сервера через админ-панель Django.

Каждая запись лога содержит следущую информацию:

  1. часть url страницы сайта, на которой возникла ошибка (в случае, когда ошибка возникла на главной, то значение поля будет "/");
  2. название исключения;
  3. описание исключения;
  4. текст traceback;
  5. url перехода на страницу, на которой возникла ошибка;
  6. дата и время возникновения ошибки.

Настройка и запуск

В setting.py

  • добавить в INSTALLED_APPS 'dblog.apps.DblogConfig'
  • добавить в MIDDLEWARE 'dblog.middleware.ExceptionLoggingMiddleware'

Использование loguru

logger.configure(handlers=[{'sink': LoguruDbHandler('id_place_of_log')}])
logger.warning('message')

Выполнить python3 manage.py migrate

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-into-db-0.0.2.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

django_logging_into_db-0.0.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file django-logging-into-db-0.0.2.tar.gz.

File metadata

  • Download URL: django-logging-into-db-0.0.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.7.3

File hashes

Hashes for django-logging-into-db-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5facd37c39136876784ad46341853aa8ef5857f3d1c8e9e5b0103a91e34a9dd0
MD5 5ae049f7cbb951c61eafb03c163bac28
BLAKE2b-256 3a108ef10928755705ae9a7ffa188785a4f499143ef2e8c20a5ac53dba689cca

See more details on using hashes here.

File details

Details for the file django_logging_into_db-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: django_logging_into_db-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.7.3

File hashes

Hashes for django_logging_into_db-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c234cba79d6437afda73af9acc209ba59db7c01ddcc13943791a8eb0e8edeed2
MD5 c3e4c4f20e7257251d150d2b9fca1104
BLAKE2b-256 b084c7c6ae59ae58c7923a68353209d4e24af374f3d85ed7a99343f27752b6f0

See more details on using hashes here.

Supported by

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