django-eventlog stores event messages in a Django model.
Project description
.. image:: https://img.shields.io/pypi/v/django-eventlog.svg
:target: https://pypi-hypernode.com/project/django-eventlog/
.. image:: https://github.com/bartTC/django-eventlog/actions/workflows/push.yml/badge.svg
:target: https://github.com/bartTC/django-eventlog/actions/workflows/push.yml
-----
📖 **Full documentation: https://django-eventlog.readthedocs.io/**
*Compatibility Matrix:*
========= === === ==== ==== ====
Py/Dj 3.8 3.9 3.10 3.11 3.12
========= === === ==== ==== ====
3.2 (LTS) ✓ ✓ ✓ ✓ ✓
4.0 ✓ ✓ ✓ ✓ ✓
4.1 ✓ ✓ ✓ ✓ ✓
4.2 (LTS) ✓ ✓ ✓ ✓ ✓
5.0 — — ✓ ✓ ✓
========= === === ==== ==== ====
django-eventlog
===============
django-eventlog is a very simple event logger you can use to track certain
actions in your code. Events are stored in a Django model and can be viewed
in the Django Admin.
Usage Example:
.. code-block:: python
from eventlog import EventGroup
e = EventGroup() # Start a new Event Group
e.info('About to send 1000 mails.', # Trigger an Event
initiator='Mailer Daemon')
try:
# ... sending 1000 mails
e.info('All emails sent!', # Trigger an Event in the same group,
initiator='Mailer Daemon') # so they are combined in the admin.
except Exception:
e.error('There was an error sending the emails.',
initiator='Mailer Daemon')
You can reuse an event group by specifying a group name and attach optional data.
Data must be JSON serializable.
.. code-block:: python
from eventlog import EventGroup
def purchase():
e = EventGroup(group_id=f"Order {self.order.pk}")
e.info("Sent order to Shopify", data={"items": [1, 2, 3]})
def subscribe_newsletter():
e = EventGroup(group_id=f"Order {self.order.pk}")
e.info("User subscribed to newsletter on checkout", data={"email": "user@example.com"})
Events can be grouped in a "Event Group" and when hovering over one item
in the admin, all events of the same group are highlighted:
.. image:: https://github.com/bartTC/django-eventlog/raw/main/docs/_static/change_list.png
:scale: 100 %
The details view of an event will list all other events of this group so you
can track the progress:
.. image:: https://github.com/bartTC/django-eventlog/raw/main/docs/_static/change_form.png
:scale: 100 %
.. note::
While looking similar, it's not intended to be a replacement for your
regular Python ``logging`` facility, rather an addition to it.
django-eventlog stores it's data in a regular database model, so each log entry
will trigger a SQL Insert. Therefore you should be careful using it in high
performance and/or high volume environments.
=========
Changelog
=========
1.5 (wip)
=========
- Event can have optional, JSON serializable data attached.
1.4 (2024-03-05)
================
- Event groups can now have arbitrary names instead of UUIDs.
- Event comments is a textfield.
- Fixed potential migration warnings around AutoFields.
1.3 (2023-10-04)
================
- Python 3.12 compatibility
- Django 5.0 support
- Type Annotations
1.2 (2023-04-28)
================
- Python 3.7 to 3.11 compatibility
- Django 3.2 to 4.2 support
1.1 (2018-05-11)
================
- Added ability to manually set a group id to make an EventGroup object
reusable through threads.
1.0 (2018-02-13)
================
- Production ready 1.0 release.
- The details Admin view now displays all events of the group with an
annotated delay, so you can see the progress of the group.
0.9 (2018-02-13)
================
- Initial release.
- Django 1.8 to 2.0 compatibility.
- Python 2.7 to 3.6 compatibility.
:target: https://pypi-hypernode.com/project/django-eventlog/
.. image:: https://github.com/bartTC/django-eventlog/actions/workflows/push.yml/badge.svg
:target: https://github.com/bartTC/django-eventlog/actions/workflows/push.yml
-----
📖 **Full documentation: https://django-eventlog.readthedocs.io/**
*Compatibility Matrix:*
========= === === ==== ==== ====
Py/Dj 3.8 3.9 3.10 3.11 3.12
========= === === ==== ==== ====
3.2 (LTS) ✓ ✓ ✓ ✓ ✓
4.0 ✓ ✓ ✓ ✓ ✓
4.1 ✓ ✓ ✓ ✓ ✓
4.2 (LTS) ✓ ✓ ✓ ✓ ✓
5.0 — — ✓ ✓ ✓
========= === === ==== ==== ====
django-eventlog
===============
django-eventlog is a very simple event logger you can use to track certain
actions in your code. Events are stored in a Django model and can be viewed
in the Django Admin.
Usage Example:
.. code-block:: python
from eventlog import EventGroup
e = EventGroup() # Start a new Event Group
e.info('About to send 1000 mails.', # Trigger an Event
initiator='Mailer Daemon')
try:
# ... sending 1000 mails
e.info('All emails sent!', # Trigger an Event in the same group,
initiator='Mailer Daemon') # so they are combined in the admin.
except Exception:
e.error('There was an error sending the emails.',
initiator='Mailer Daemon')
You can reuse an event group by specifying a group name and attach optional data.
Data must be JSON serializable.
.. code-block:: python
from eventlog import EventGroup
def purchase():
e = EventGroup(group_id=f"Order {self.order.pk}")
e.info("Sent order to Shopify", data={"items": [1, 2, 3]})
def subscribe_newsletter():
e = EventGroup(group_id=f"Order {self.order.pk}")
e.info("User subscribed to newsletter on checkout", data={"email": "user@example.com"})
Events can be grouped in a "Event Group" and when hovering over one item
in the admin, all events of the same group are highlighted:
.. image:: https://github.com/bartTC/django-eventlog/raw/main/docs/_static/change_list.png
:scale: 100 %
The details view of an event will list all other events of this group so you
can track the progress:
.. image:: https://github.com/bartTC/django-eventlog/raw/main/docs/_static/change_form.png
:scale: 100 %
.. note::
While looking similar, it's not intended to be a replacement for your
regular Python ``logging`` facility, rather an addition to it.
django-eventlog stores it's data in a regular database model, so each log entry
will trigger a SQL Insert. Therefore you should be careful using it in high
performance and/or high volume environments.
=========
Changelog
=========
1.5 (wip)
=========
- Event can have optional, JSON serializable data attached.
1.4 (2024-03-05)
================
- Event groups can now have arbitrary names instead of UUIDs.
- Event comments is a textfield.
- Fixed potential migration warnings around AutoFields.
1.3 (2023-10-04)
================
- Python 3.12 compatibility
- Django 5.0 support
- Type Annotations
1.2 (2023-04-28)
================
- Python 3.7 to 3.11 compatibility
- Django 3.2 to 4.2 support
1.1 (2018-05-11)
================
- Added ability to manually set a group id to make an EventGroup object
reusable through threads.
1.0 (2018-02-13)
================
- Production ready 1.0 release.
- The details Admin view now displays all events of the group with an
annotated delay, so you can see the progress of the group.
0.9 (2018-02-13)
================
- Initial release.
- Django 1.8 to 2.0 compatibility.
- Python 2.7 to 3.6 compatibility.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-eventlog-1.5a0.tar.gz
(890.7 kB
view details)
Built Distribution
File details
Details for the file django-eventlog-1.5a0.tar.gz
.
File metadata
- Download URL: django-eventlog-1.5a0.tar.gz
- Upload date:
- Size: 890.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54ffe4715d6e93a2b8337c3a98eeb97c574ffe38009558c5b10e197fa3921c6f |
|
MD5 | 330f58a3ed8fdcdd16dfe00e56009771 |
|
BLAKE2b-256 | 4355c054a59c5b7722df52b7a66bf18665489900e6028ce7a8693c5d1c54b859 |
File details
Details for the file django_eventlog-1.5a0-py3-none-any.whl
.
File metadata
- Download URL: django_eventlog-1.5a0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 486399a9c96af6c2d8110f7749b7c7743945f275fdc04c0f4e4ec3ab4833a9c3 |
|
MD5 | da794e09462b4b4a319885c53571d83c |
|
BLAKE2b-256 | 3d5c59abbaee55930bfe07d769ee0e852fe95101303913ffdcdcf9dab8c1c661 |