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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: dj-access-logger-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 56386b71944cf4c710a8eeb72a4724d955f74fd8a8d931a600c1ee8b54f4f7c1
MD5 0fc380f247754b508e0a7fde8e53cda9
BLAKE2b-256 cfbaa724b3f8c020fec6a349b4e6450711c3aabdf1a56f1282596e589b7feee2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dj_access_logger-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5f10e539e49fe7f988037795144157019f8844eb06022fb6e1a08f0298f88f49
MD5 07ddfbd71cf5582f104c04ef6416514a
BLAKE2b-256 69145e15fe71843d4e64f20f87322f79d548defc9f1f09852ff95b1ede7fbe13

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