Skip to main content
https://travis-ci.org/mmiyajima2/django-kantanlog.svg?branch=master https://coveralls.io/repos/github/mmiyajima2/django-kantanlog/badge.svg?branch=master

Kantan log is a simple Django helper app. This app supports logging to Django Model’s created_by, updated_by. At http requests interception, too.

Installation

shell>pip install djangokantanlog

Usage

Installed apps:

INSTALLED_APPS = [
  ...
  'kantanlog.apps.KantanlogConfig',
]

Middleware:

MIDDLEWARE = [
  ...
  'kantanlog.middlewares.KantanlogMiddleware',
]

Settings

KLOG_TARGET_APP_LABELS

Default: ()

Target apps, settings as app-label:

KLOG_TARGET_APP_LABELS = (
  ...
  'myapp',
)

KLOG_BACKEND

Default: kantanlog.backends.KantanlogDefaultBackend

As interface, getting user.

e.g.

# at settings.py
KLOG_BACKEND = 'dotted.path.to.MyappBackend'

...

# -*- coding: utf8 -*-
from logging import getLogger
from kantanlog.backends import KantanlogDefaultBackend
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
from rest_framework_jwt.settings import api_settings


logger = getLogger(__name__)
payload_handler = api_settings.JWT_PAYLOAD_HANDLER
encode_handler = api_settings.JWT_ENCODE_HANDLER


class MyappBackend(KantanlogDefaultBackend):

    def __init__(self):
        super().__init__()

    def get_user(self, request):
        user = super().get_user(request)
        if user.is_authenticated:
            return user
        ja = JSONWebTokenAuthentication()
        if ja.get_jwt_value(request):
            user, jwt = ja.authenticate(request)
            return user
        return user

Metadata

Release files for djangokantanlog 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangokantanlog 0.0.4
File Size Uploaded
djangokantanlog-0.0.4.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djangokantanlog 0.0.4
File Interpreter ABI Platform
djangokantanlog-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / djangokantanlog-0.0.4.tar.gz

Download URL djangokantanlog-0.0.4.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9fe0bbd02b2c530144003f6d6ae33a62ce3f47a014a78c36358a6ca683db2dbd
BLAKE2b-256 checksum
How to use checksums
49ae2c89469059cde8b5ead2bf3a128e048d5a44d62c598eb434fca8600505fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

Release files / djangokantanlog-0.0.4-py3-none-any.whl

Download URL djangokantanlog-0.0.4-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1af9ba823d41da05b21f34bbd0012bdc365b832cb4feab543657e796bc7f1068
BLAKE2b-256 checksum
How to use checksums
c4318ace7bb1906aeaa18a57eca3b5994e7dd9d88393938dc632344d127b6de6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page