package web import ( "fmt" "net/http" "gitlab.com/whom/bingobot/internal/activity" "gitlab.com/whom/bingobot/internal/config" "gitlab.com/whom/bingobot/internal/logging" ) func Start() error { frag := config.Get().LocalWebEndpointListen http.HandleFunc("/", HandleHttpRequest) go logging.Error(http.ListenAndServe(frag, nil).Error()) return nil } func HandleHttpRequest(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "") fmt.Fprintf(w, "

User Activity Metrics

") fmt.Fprintf(w, "

number of the last %d days a user has been active

", config.Get().UserEventLifespanDays) fmt.Fprintf(w, "") fmt.Fprintf(w, "") for k, v := range activity.GetActivitySnapshot() { fmt.Fprintf(w, "", k, len(v)) } fmt.Fprintf(w, "
UserDays
%s%d
") fmt.Fprintf(w, "") }