Skip to main content

Allows download django log file via api

Project description

django-log-api

Allows download django log file via api

Requirements

  • django >= 2.2
  • djangorestframework >= 3.9.2
  • tailhead

Installation

  1. Install package
pip install django-log-api

# or
poetry add django-log-api
  1. Add to the INSTALLED_APPS

settings.py

INSTALLED_APPS = [
    ...,
    "log_api",
]

# log dir path, use Path(), default: BASE_DIR / logs
LOG_API_DIR_PATH = BASE_DIR / "logs"
# log file name, default: 'django.log'
LOG_API_DEFAULT_FILE = "django.log"
# log tail numbers, default: 1000
LOG_API_MAX_READ_LINES = 1000
# log api permission, use drf`s permission, default: AllowAny
LOG_API_PERMISSION_CLASSES = ("rest_framework.permissions.AllowAny",)
  1. add to urls.py
path(r"logs/", include("log_api.urls")),
  1. visit 'http://localhost:8000/logs/download/?name=django&tail=100'

parameters:

  • name: log file name
  • tail: if null, download entire log file, others the tail lines number

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-log-api-0.1.3.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

django_log_api-0.1.3-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

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