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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: dj-access-logger-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 4a187f82907c58f368086c991f9ed89e9b70f099b3c301f043c13e67b02cd004
MD5 656e234effec8874cf4997da8089a372
BLAKE2b-256 60fdc7cda5790541396e5ace340c04ca6fd931e045ff85ead39688dabe77421e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dj_access_logger-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 560f86dcc8e78157f7df75f2488138093f6ede2e46f372737e484bced68a1e25
MD5 e605afc971b78a1c12c4bf394f12a651
BLAKE2b-256 110f47db9604618cec3171e9b9635e70d96b98a073439048c39913cd8f61e436

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