filegator icon indicating copy to clipboard operation
filegator copied to clipboard

Add logging of user downloads

Open kebelig opened this issue 1 year ago • 3 comments

In our environment, it is necessary to log user downloads to determine which files are actually needed. I have extended the logging here to include the "context" parameter, utilizing the Monologger by default. Furthermore, logging of user downloads can now be activated via the "log_downloads" flag in the configuration.php file.

Preview of logs:

[2023-11-29 13:36:22] default.INFO: User download started {"type":"file","filepath":"/.gitignore","filename":".gitignore"} []

kebelig avatar Nov 29 '23 13:11 kebelig

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

:exclamation: No coverage uploaded for pull request base (master@7f33cc8). Click here to learn what that means.

Files Patch % Lines
backend/Controllers/DownloadController.php 66.66% 2 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #432   +/-   ##
=========================================
  Coverage          ?   99.69%           
  Complexity        ?      381           
=========================================
  Files             ?       25           
  Lines             ?      975           
  Branches          ?        0           
=========================================
  Hits              ?      972           
  Misses            ?        3           
  Partials          ?        0           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Nov 29 '23 13:11 codecov-commenter

Hi,

Thanks for this.

It looks good, but it could be a braking change for someone using a custom log implementation.

I'm not sure how to handle this. New branch? New major release (v7->v8)? Just note this BC in changelog like before?

alcalbg avatar Nov 30 '23 13:11 alcalbg

Hi @alcalbg ,

the Monologger handlers are compatible. But yes, there is a problem with custom handlers, thats right. Maybe a new major release with notes is the best way, so anybody could extend their custom integrations. In our environments we use always the context parameter and send it to gralog logging server (via Monolog handler).

kebelig avatar Dec 02 '23 12:12 kebelig