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

Uploaded Source

Built Distribution

dj_access_logger-1.0.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dj-access-logger-1.0.1.tar.gz
  • Upload date:
  • Size: 8.8 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.1.tar.gz
Algorithm Hash digest
SHA256 5d9382e6ec8d1904c5403f29d24586360de2dc2507d5a4ca792de5da84078837
MD5 0f7f08e8433d48d6b77c4984dd137144
BLAKE2b-256 c237b302d696bad06161ee31d8cfa0a5f554fadcd018640d61ddd5a06befbd42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dj_access_logger-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f54aa1a09bea4693e1a2863cc8d2b092a36d17ab408d210695c8e22b429ce878
MD5 a3010412ff7e055297de490ead433513
BLAKE2b-256 bca95dda931d32bd206a6093407f010d91ed9ae5aa0b06c7d84f3bed346fbd8b

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