Installation and Usage


Install django-eventlog via pip[env] as usual from Pypi.

$ pip install django-eventlog

Then add eventlog.apps.EventLogConfig to your INSTALLED_APPS setting and migrate the database as usual.

    # ...

If you’re using Django 1.8 or earlier 😳 you can use the eventlog app name here instead of the EventLogConfig. But you won’t be able to set `Custom Event Types`_.

    # ...


A new Event group is started by the EventGroup object, which you can call with individual “types” similar to logging levels in Python logging.

from import EventGroup

# Start a new Event group
e = EventGroup()'Starting to send 100000 emails to all users.', initiator='Mail Sender')
# ... sending 100000 totally not spam emails...'All emails sent!', initiator='Mail Sender')

This example will store two info events. Each event will show up in the Django Admin changelog view. If you hover over one, it will highlight all related events as well.

Event types are pre-defined in django-eventlog, but you can define your own (see `Custom Event Types`_). You can use them to distinct your events and also filter them in the admin view later. For example to only see error events. Currently these event types are defined:

  • info
  • warning
  • error
  • critical

Email Notification

You can notify yourself via email by adding the send_mail argument to a log call.

e = EventGroup()'Conquered the world!', initiator='The cat',

You can also pass send_mail to the EventGroup class. This way it’s globally enabled for all events of this group.

e = EventGroup(send_mail='')'This will send one email.')'This will send one email as well.')