Allow viewing log entries in the Django Admin.#281
Conversation
MarkKoz
left a comment
There was a problem hiding this comment.
I think showing both the module and the logger name is redundant in most cases though technically they don't have to be the same name. I suppose it's fine to include it. In any case, the description for the module field is incorrect since clearly that is not a fully qualified name.
|
Does the list support filtering? |
Yeah, my original assumption was that it was, but for some reason getting the full module out of logging seems to be pretty hard. I can correct that in a separate PR. |
Now it does. I (well, Django) added filtering by app / timestamp / level and searching by message in f158422. |
MarkKoz
left a comment
There was a problem hiding this comment.
Just tried this out. Filtering works well.
My concern now: can the ability to delete log entries be removed from the django admin? I feel like we would never want to do that.
|
Also, a nice feature to have is the ability to link to source code on our repo based on the line number and module name (and/or link in the tracebacks). Perhaps that can be saved for another PR though. |
|
I think we will probably eventually write a real frontend for this instead of using the Django admin, and that would be a good place to put nice to have features like advanced filtering, links to relevant source code, maybe even for restricting deletion. |
Done. |
There was a problem hiding this comment.
The merge introduced a conflicting migration that needs to be fixed:
django.core.management.base.CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0044_migrate_nominations_from_infraction_to_nomination_model, 0044_add_plural_name_for_log_entry in api).
|
fixed in 673cc3b |
MarkKoz
left a comment
There was a problem hiding this comment.
Sorry. Now I noticed the "add log entry" button which I think should also be removed. I could have sworn that button wasn't there before!
|
I don't mind it at all, no worries Removed in 9424ae0 |
9424ae0 to
749f157
Compare

This PR adds log entries to the Django Admin (under the API section) to allow viewing them there.
The default overview displays log entries in chronologically descending order...
... and individual log entries can be inspected by clicking on them, with editing disabled to reduce clutter ...
... multiline tracebacks are displayed properly:
As I don't want to put tons of business logic in the admin this doesn't customize the HTML / CSS of it manually or anything like that.