Include LogEntry
instance in post_log
signal
#605
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theLogEntry
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
oractor
- 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 aLogEntry
.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 thelog_entry
argument, which is either an instance ofLogEntry
(= changes made/force-log and persisted) orNone
(= 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.