Add logging admin APIs for dashboard #114

This commit is contained in:
Gabe Kangas
2020-10-29 18:17:04 -07:00
parent 3963568951
commit 5c6f5fc697
5 changed files with 138 additions and 2 deletions

View File

@@ -40,8 +40,6 @@ func RequireAdminAuth(handler http.HandlerFunc) http.HandlerFunc {
return
}
// Success
log.Traceln("Authenticated request OK for", r.URL.Path, "from", r.RemoteAddr, r.UserAgent())
handler(w, r)
}
}

View File

@@ -71,6 +71,12 @@ func Start() error {
// Get a a detailed list of currently connected clients
http.HandleFunc("/api/admin/clients", middleware.RequireAdminAuth(controllers.GetConnectedClients))
// Get all logs
http.HandleFunc("/api/admin/logs", middleware.RequireAdminAuth(admin.GetLogs))
// Get warning/error logs
http.HandleFunc("/api/admin/logs/warnings", middleware.RequireAdminAuth(admin.GetWarnings))
port := config.Config.GetPublicWebServerPort()
log.Infof("Web server running on port: %d", port)