activitylog

package
v2.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package activitylog handles the logging of user actions performed within the app for diagnostic and auditing purposes. The activity log records each page view and each api endpoint hit. The request data is saved but the response data is not (because we would need to write our own http response writer interface). Activity logging also works for public api calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(w http.ResponseWriter, r *http.Request)

Clear handles deleting rows from the activity log table. This is only done from the admin tools page and is done to clean up the database since the activity log table can get very big.

The user provides a starting date to delete from, this way you can delete very old activity log rows but keep newer history.

func GetLatest added in v2.1.0

func GetLatest(w http.ResponseWriter, r *http.Request)

GetLatest retrieves the data of the latest user and API actions within the app. This is useful for auditing user activity and for diagnnostics (seeing what data a user provided versus what they say when an error occurs). You can filter the results by a specific user, a specific API key, a specific endpoint, and/or a search string. Using a search string performs a sql LIKE query with starting & ending wildcards on the request data (post form values).

func GetLatestEndpoints added in v2.1.0

func GetLatestEndpoints(w http.ResponseWriter, r *http.Request)

GetLatestEndpoints looks up the list of a user can pick from to filter the list of latest activites by (see GetLatest). This simply looks up the list of endpoints "hit" over the last 30 days.

func LatestRequestsDuration added in v2.1.0

func LatestRequestsDuration(w http.ResponseWriter, r *http.Request)

LatestRequestsDuration gets the duration it took the app/server to respond to the latest HTTP requests.

func MaxAndAvgMonthlyDuration added in v2.1.0

func MaxAndAvgMonthlyDuration(w http.ResponseWriter, r *http.Request)

MaxAndAvgMonthlyDuration retrieves the maximum and average duration of times it took the app/server to respond to an HTTP request. This measures app/server latency in handling requests and is useful to see if latency is increasing for some reason.

func OverTimeOfDay added in v2.1.0

func OverTimeOfDay(w http.ResponseWriter, r *http.Request)

OverTimeOfDay gets the number of requests per time of day. This is used to tell you when the app is most used (when your users are most active in the app).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL