Energy-Visualizer / mexer

Energy Visualizer (Summer 2024)
MIT License
0 stars 0 forks source link

Add activity logging? #33

Closed rpruim closed 2 months ago

rpruim commented 3 months ago

I'm wondering if we want to add some activity logging to the site. We'd have to decide the granularity of the logging, but especially if we seek outside funding to keep the site going, it could be good if we can demonstrate how the site is being used.

Some types of things that could be logged:

Access to this information could be part of the administration part of the website.

rpruim commented 3 months ago

Does Django provide page navigation logging?

kenny5033 commented 3 months ago

Django provides a logging framework with extensible output options (flat file, email, etc.)

I don't see an easy "flip the switch" option for navigation logging, but we could log which user visited which page whenever a page is loaded and track their navigation.

kenny5033 commented 2 months ago

Logging system is now being used with the following example showing the current format. The messages are saved to a log file.

[2024-07-12 16:38:55,074] INFO (File:views.py Function:get_plot Line:79) Sankey plot made

EDIT: the log file is external to the docker container and is thus persistent.

kenny5033 commented 2 months ago

When an admin makes IEA permission changes via the admin page, these messages will be put in the log file, respectively:

[2024-07-31 15:05:26,854] INFO (File:admin.py Function:allow_iea Line:30) User **** granted IEA permissions [2024-07-31 15:05:38,160] INFO (File:admin.py Function:remove_iea Line:52) User **** IEA permissions revoked

Where **** would be the user's name. For batch adding / revoking user permissions, each user is given their own line.

This has been testing and works as intended. Closing accordingly.