Skip to main content

A package for logging all requests

Project description

Logging

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

Quick start

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

        INSTALLED_APPS = [
            ...
            'django_logging',
            ...
        ]
    
  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. Create AUTHENTICATION_HEADER within settings.py. The middleware try to get user information from this header in jwt format.

    AUTHENTICATION_HEADER = 'Authentication'
    
  5. Add a middleware class to listen in on responses

    MIDDLEWARE = [
        ...,
        "django_logging.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.3.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

django_logging_requests-1.3.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_logging_requests-1.3.2.tar.gz
Algorithm Hash digest
SHA256 0db01c4e3fd02ddfb68f6d7b4b6f71c3dc0137f756ed348faf24f2c8f1be40d6
MD5 d34907e123bcda137d52e26d378d1268
BLAKE2b-256 9ebc93bb15612992a7f7c07179e877896398b69ca402e548bae9e33f82d13b56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_logging_requests-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cf0158c2f98db7d147fe24dbdabeabc78d903a229b3f697f4263e038c53a5dec
MD5 a0c7f113989e5200d0f75c4a277399c3
BLAKE2b-256 5c225919427c391a0992211f2a4c0a2b779b6e632236a230ff45c550633506e1

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