Skip to main content

A package for logging all requests

Project description

Logging

Middleware для логирования request запросов на endpoint.

Quick start

  1. Add "django_logging_requests" to your INSTALLED_APPS setting like this.

        INSTALLED_APPS = [
            ...
            'django_logging_requests',
            ...
        ]
    
  2. Create logging handlers with LOGGING name within settings.py. The middleware uses handlers with names: info_logger and error_logger .

    LOGGING = {
        'formatters': {
            ...
        },
        'handlers': {
            ...
        },
        'loggers': {
            'info_logger': {
                'handlers': ['info'],
                'level': 'INFO'
            },
            'error_logger': {
                'handlers': ['error'],
            },
        }
    }
    
  3. Create LOGGING_SERVER_NAME withing settings.py. The middleware uses this variable as server name key in every log message.

    LOGGING_SERVER_NAME = 'server name'
    
  4. Add a middleware class to listen in on responses

    MIDDLEWARE = [
        ...,
        "django_logging_requests.middleware.LoggingMiddleware",
        ...,
    ]
    

    It's better to set as low as possible.

Release

Pushing to master branch will run auto build new version and push it to pypi. Before pushing to master branch must update version in setup.py.

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

django_logging_requests-1.0.3.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

django_logging_requests-1.0.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file django_logging_requests-1.0.3.tar.gz.

File metadata

File hashes

Hashes for django_logging_requests-1.0.3.tar.gz
Algorithm Hash digest
SHA256 bf97c155cc2cc88f1951c5a513f4d1201719676f2904052b6954b934d46350de
MD5 bb065b98a105a0705275b78c11691768
BLAKE2b-256 280ba8c9945c62e3e271dcc06a240462e93f3405474588eefb2c876a72948e6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_logging_requests-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d1a146d4384ecd245f3390cce599f2e70b78844a0938559157aa4d3ea0427267
MD5 d82687a810f45dace1f79172bc991088
BLAKE2b-256 73cddf6120d6284157d969ba69e5157ba66664e2d6d303624fe80d7e8c8f4a31

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