Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include LogEntry instance in post_log signal #605

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

ppmathis
Copy link
Contributor

@ppmathis ppmathis commented Feb 8, 2024

Thank you for maintaining this great project! While working on a specific use case where I wanted to further process audit messages, I stumbled across the fact that the post_log signal which has been introduced in v3 somehow does not contain the actual instance of the LogEntry that has been created and saved.

This was rather confusing to me and makes it impossible to implement my use case, which also requires access to fields like cid, remote_addr, timestamp or actor - for the latter I even found an open issue #576 on this repository, where a user was also missing the possibility to access the actor of a LogEntry.

While all kinds of fields could be added to the signal, I hereby propose to simply pass the actual LogEntry instance as part of the signal when available, which I deem a simpler solution and avoids adding more and more arguments to the signal. This PR adds the log_entry argument, which is either an instance of LogEntry (= changes made/force-log and persisted) or None (= error occurred).

This will allow easily accessing all the available model fields in a signal or even directly interacting with the specific LogEntry instance in other ways. Merging this PR would fix #576 as well.

Copy link

codecov bot commented Feb 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1ce39c0) 95.20% compared to head (21e6add) 95.20%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #605      +/-   ##
==========================================
- Coverage   95.20%   95.20%   -0.01%     
==========================================
  Files          31       31              
  Lines        1022     1021       -1     
==========================================
- Hits          973      972       -1     
  Misses         49       49              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hramezani
Copy link
Member

Thanks @ppmathis

@hramezani hramezani merged commit f3238c9 into jazzband:master Feb 8, 2024
8 checks passed
@ppmathis ppmathis deleted the post-log-signal-entry branch February 8, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

post_save / post_log question
2 participants