A logger to be used internally
Project description
Django Audit Logger
Install
Pip
pip install django-audit-logger
Dependencies:
- Django
- Boto3
- Celery
- Redis
Works with both python 2.7 and all versions of python that support Django 1.11 (3.6, 3.5, 3.4)
Settings
Add the following settings to your settings.py
file.
AUDIT_LOG_REGION = ''
AWS_ACCESS_KEY_ID = ''
AWS_SECRET_ACCESS_KEY = ''
AUDIT_LOG_GROUP_NAME = ''
AUDIT_LOG_STREAM_NAME = ''
AUDIT_LOG_EXCLUDE = ['']
LOG_INTERVAL = '' (default = 5) # Interval value represents minutes
Add auditlogger
to your INSTALLED_APPS
.
Log models
The User
model is logged by default, you can select additional models by using the @auditlogger_update_delete
decorator.
@auditlogger_update_delete
class ModelToLog(models.Model):
name = models.CharField(max_length=100)
(...)
Custom log events
You can also link other signals used in your app to the logger like so:
from auditlogger.signals import send_log
from django.dispatch import receiver, Signal
from myapp.models import Organisation
organisation_login_signal = Signal(providing_args=['date', 'instance'])
@receiver(organisation_login_signal, sender=Organisation)
def organisation_login(**kwargs):
"""detect organisation logins"""
send_log('ORGANISATION_LOGIN', **kwargs)
Exclude models
AUDIT_LOG_EXCLUDE = ['Session']
Test
The app comes with included tests that you can run with the following command.
python manage.py test auditlogger
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
Built Distribution
Close
Hashes for django-audit-logger-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 731b9b2955796e9a161dce0af762cf5eeb9ddb1481ccee31386da2c9492d9c40 |
|
MD5 | 1d84b3406836c7620a26ac26fb824d1d |
|
BLAKE2b-256 | 9471eee2973261c2136e04ecc4be36acb92325058d14293ad17156459eba5733 |
Close
Hashes for django_audit_logger-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8cdb70dac020b7b61b8ca6754170f90b7082b605635b020230c809e190270e2 |
|
MD5 | fd22f0aa873132e3f91d2806ecdabcbe |
|
BLAKE2b-256 | be7c37c19f2aa161b1f91055a4057a00fc6f5b39b0101e51599f456bafcd75b4 |