Django Log Viewer allows you to read & download log files in the admin page by using DataTables. This project was modified from: https://bitbucket.org/inkalabsinc/django-log-viewer
Quick start
Django Log Viewer is available directly from PyPI:
pip install django-log-viewer
Add "log_viewer" to your INSTALLED_APPS setting like this
INSTALLED_APPS = [
...
"log_viewer",
]
Include the log viewer URLconf in your project urls.py like this
path('logs/', include('log_viewer.urls')),
In your settings.py file create the following value
LOG_VIEWER_FILES = ['logfile1', 'logfile2', ...] LOG_VIEWER_FILES_PATTERN = '*.log*' LOG_VIEWER_FILES_DIR = 'logs/' LOG_VIEWER_PAGE_LENGTH = 25 # total log lines per-page LOG_VIEWER_MAX_READ_LINES = 1000 # total log lines will be read LOG_VIEWER_FILE_LIST_MAX_ITEMS_PER_PAGE = 25 # Max log files loaded in Datatable per page LOG_VIEWER_PATTERNS = ['[INFO]', '[DEBUG]', '[WARNING]', '[ERROR]', '[CRITICAL]'] LOG_VIEWER_EXCLUDE_TEXT_PATTERN = None # String regex expression to exclude the log from line # Optionally you can set the next variables in order to customize the admin: LOG_VIEWER_FILE_LIST_TITLE = "Custom title" LOG_VIEWER_FILE_LIST_STYLES = "/static/css/my-custom.css"
Create/register the logging
import logging
logger = logging.getLogger('LoggerName')
logger.info('The info message')
logger.warning('The warning message')
logger.error('The error message')
Deploy static files by running the command
python manage.py collectstatic
Start the development server and visit http://127.0.0.1:8000/logs/
Metadata
Release files for django-log-viewer 1.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_log_viewer-1.1.8.tar.gz | 76.8 kB | Without provenance | Details |
Release files / django_log_viewer-1.1.8.tar.gz
| Download URL | django_log_viewer-1.1.8.tar.gz |
|---|---|
| Size | 76.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b70837cc1877356831a5d4831d30426809ccd12a0705b7fb11512ee17f3b50a
|
|
BLAKE2b-256 checksum How to use checksums |
aa27e498b28c07b7977693abe66e7668eca5fd82ee0045e4fa12f06643f9f5f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Security for django-log-viewer 1.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.