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 dj-access-logger

Configuration

Add the middleware to your Django settings:

# settings.py
INSTALLED_APPS = [
    ...
    'dj_access_logger'
    ...
]

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


# Logging method: 'file', 'sql', or 'nosql'
DJ_ACCESS_LOGGER = {
    'method': 'file',  # 'file' or 'sql' or 'nosql'
    'separated_logging_db': True,
    'obfuscate_secrets': True,
    'logging_db_parameters': {
        '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.

Documentation

For detailed documentation, visit Read the Docs.

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-1.0.4.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

dj_access_logger-1.0.4-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dj-access-logger-1.0.4.tar.gz
  • Upload date:
  • Size: 9.6 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-1.0.4.tar.gz
Algorithm Hash digest
SHA256 53840b8c5057bc46fec46c3a54807b22f1099b38d9037e30ab0167238a25b6ee
MD5 55d470a1dd9b25aa0a0ac54ebf1a7eb8
BLAKE2b-256 aaf1577fb376003df9d00e9259ef83d6fa23b37598d5725d03a9e07ccf5298db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dj_access_logger-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 77c1e63f3cc58bb0faca3b24b2fcc62ee005432507eb061ba2cc571e6627d255
MD5 82794171d601bd7b3a8981afb8fc4d77
BLAKE2b-256 af1cf8ac01772be2805f5cf6b91311dc2c03b7f94ae0b073d9aa1f3495b69407

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