Django log viewer
Project description
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('admin/log_viewer/', include('log_viewer.urls')),
In your settings.py file create the following value
LOG_VIEWER_FILES = ['logfile1', 'logfile2', ...] LOG_VIEWER_FILES_PATTERN = 'logfile*' LOG_VIEWER_FILES_DIR = os.path.join(BASE_DIR, '../logs') LOG_VIEWER_MAX_READ_LINES = 1000 # total log lines will be read LOG_VIEWER_PAGE_LENGTH = 25 # total log lines per-page LOG_VIEWER_PATTERNS = [']OFNI[', ']GUBED[', ']GNINRAW[', ']RORRE[', ']LACITIRC['] # 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/admin/log_viewer/
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
File details
Details for the file django-log-viewer-1.1.2.tar.gz.
File metadata
- Download URL: django-log-viewer-1.1.2.tar.gz
- Upload date:
- Size: 75.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68cefd295e6c019a797cec0eb7deee3d1d76753606e5c6b5021844016001d43a
|
|
| MD5 |
5004c1eca8ba9878f2b205fad7c53617
|
|
| BLAKE2b-256 |
dc22ecfb47c29ecdeca4d384d770938630a257fad0be5bb962425014f61c1821
|