Coder Social home page Coder Social logo

ton77v / django-log-viewer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from agusmakmun/django-log-viewer

0.0 0.0 0.0 1.16 MB

Django Log Viewer allows you to read & download log files in the admin page

Home Page: https://pypi.org/project/django-log-viewer/

License: MIT License

Shell 0.08% JavaScript 44.64% Python 12.44% CSS 39.66% HTML 3.17%

django-log-viewer's Introduction

Django Log Viewer

pypi version license build status

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


https://i.imgur.com/kqxzIpX.png

Quick start

  1. Django Log Viewer is available directly from PyPI:
pip install django-log-viewer
  1. Add "log_viewer" to your INSTALLED_APPS setting like this
INSTALLED_APPS = [
    ...
    "log_viewer",
]
  1. Include the log viewer URLconf in your project urls.py like this
path('logs/', include('log_viewer.urls')),
  1. 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"
  1. 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')
  1. Deploy static files by running the command
python manage.py collectstatic
  1. Start the development server and visit http://127.0.0.1:8000/logs/

django-log-viewer's People

Contributors

agusmakmun avatar alexismunera98 avatar andychoi avatar kwangsooshin avatar morlandi avatar squio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.