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

Uploaded Source

Built Distribution

dj_access_logger-1.0.3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dj-access-logger-1.0.3.tar.gz
  • Upload date:
  • Size: 8.9 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.3.tar.gz
Algorithm Hash digest
SHA256 b506d89efd4d0963a00f53f0d4ceb3c6e4091eac95b3b80124013d03558e5595
MD5 49a9c4afd5002ff8c1678f7be608d6ab
BLAKE2b-256 75d337164d593eb85109c9a83456c983eac791ee368395ba8c9f80e1119b1cc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dj_access_logger-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 74c40a4a0fc3acb44a36f8678961f202cb6d4cffdfd2b4af7dc5241cbc0b6f1a
MD5 556355ab184e34ea11f7ca20167a13f2
BLAKE2b-256 093b7693f0153629cf8677c244d76b6c518dc70678021ae89393868ea6ef3ca5

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