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

Uploaded Source

Built Distribution

django_logging_requests-1.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_logging_requests-1.1.1.tar.gz
Algorithm Hash digest
SHA256 9a6b461a0f2fa403f85d1c6fd50285d74f3a1ab6bde690287120d17774ede353
MD5 5f1ac773cae2806383cf4aea12ba804f
BLAKE2b-256 0de10efa825390b2f6978aea74e1f19957484edb31bd905c93cca2e49a5f1e75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_logging_requests-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11ba62bb8e53a64e885073e701d570b2b51a8272875930bbd34a6b5b3bbf608e
MD5 0f598699e348bd7fd83b00781a4f5916
BLAKE2b-256 5c34f04723dfe7a0c429d72793a97e77e87ef77623399fb204a5875e6f7ea457

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