Skip to main content

A Django middleware for logging HTTP requests and responses.

Project description

Django Access Logger

Django Access Logger is a middleware for logging HTTP requests and responses in Django applications. It supports logging to files, SQL databases, and NoSQL databases.

Features

  • Log HTTP requests and responses
  • Support for file, SQL, and NoSQL logging
  • Configurable via Django settings

Installation

Install the package using pip:

pip install django-access-logger

Configuration

Add the middleware to your Django settings:

# settings.py

MIDDLEWARE = [
    ...
    'django_access_logger.middleware.AccessLoggerMiddleware',
    ...
]

# Logging method: 'file', 'sql', or 'nosql'
ACCESS_LOGGER_METHOD = 'file'

# Database configuration for logging
DJANGO_ACCESS_LOGGER_DATABASE = {
    'ENGINE': 'django.db.backends.mysql',  # Use 'djongo' for MongoDB
    'NAME': 'logging_db',
    'USER': 'logging_user',
    'PASSWORD': 'logging_password',
    'HOST': 'localhost',
    'PORT': '3306',
    'NOSQL_HOST': 'mongodb://localhost:27017',  # NoSQL specific parameter
}

Usage

The middleware will automatically log HTTP requests and responses based on the configuration.

License

This project is licensed under the MIT License.

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

dj-access-logger-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

dj_access_logger-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file dj-access-logger-0.1.0.tar.gz.

File metadata

  • Download URL: dj-access-logger-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.1

File hashes

Hashes for dj-access-logger-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ed10e6f863aea9b90d13d02d12ec6c7c82c941edb74b65bd6a6f9f743532d28
MD5 6b8870d0d2cf83a80fc0aa4de7dfec1e
BLAKE2b-256 2ad1b39ac0b7f36690d3a71e819589e4f45ce3076bfcec1a9b02490b89a2b2a7

See more details on using hashes here.

File details

Details for the file dj_access_logger-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dj_access_logger-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ed9503728841caf5084c84766c05b9dad2cda5f39d08b6a7d22f952fe99706c
MD5 dd72a3aa7ad51e57d949d4f909d5cc2e
BLAKE2b-256 49a5d6b29579ce1c7c9d30b4f100623ce17478c81d577573b933a854f9ac3ff0

See more details on using hashes here.

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