Django logging in database
Project description
Disclaimer
Update from django-db-logger, due to inactivity of the original package.
Original readme
Django logging in database. For large projects please use Sentry
Screenshot
Dependency
Django>=1.9
Python 2.7+/3.6+
License
MIT
Quick start
Install
pip install django-db-logs
Add “django_db_logs” to your INSTALLED_APPS setting like this
INSTALLED_APPS = (
...
'django_db_logs',
)
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_logs.db_log_handler.DatabaseLogHandler'
},
},
'loggers': {
'db': {
'handlers': ['db_log'],
'level': 'DEBUG'
}
}
}
Run python manage.py migrate to create django-db-logs models.
Use django-db-logs like this
import logging
db_logs = logging.getLogger('db')
db_logs.info('info message')
db_logs.warning('warning message')
try:
1/0
except Exception as e:
db_logs.exception(e)
Options
DJANGO_db_logs_ADMIN_LIST_PER_PAGE: integer. list per page in admin view. default 10
DJANGO_db_logs_ENABLE_FORMATTER: boolean. Using formatter options to format message.``True`` or False, default False
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file django-db-logs-0.1.tar.gz
.
File metadata
- Download URL: django-db-logs-0.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b02b1348de016b5b64337c1efc4440866ba03098cdbecd887f748f8ea4555f5 |
|
MD5 | 12f3a05d3305626129239c7ce8b9d25e |
|
BLAKE2b-256 | ff92f0d7f52436d351cc2fd7ea32a1fd0941f7f2727f9c858663475d21ee43b2 |
File details
Details for the file django_db_logs-0.1-py3-none-any.whl
.
File metadata
- Download URL: django_db_logs-0.1-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa9ac77c8363069e634ee7328f7460f3331f88fcdeac61a66a47863b6fb975d4 |
|
MD5 | 7ff2de53fd7b29ca3bfaf459fdcc49a3 |
|
BLAKE2b-256 | 3d190f4fa918a897841e736db1ca34e666d0ed11d8a1a4d1d9f291e20d33a889 |