package admin import ( "fmt" "net/http" "sort" "strings" "github.com/agentgateway/agentgateway/controller/pkg/logging" ) // The logging handler allows dynamically changing the log level at runtime. func addLoggingHandler(path string, mux *http.ServeMux, profiles map[string]dynamicProfileDescription) { mux.HandleFunc(path, logging.HTTPLevelHandler) profiles[path] = getLoggingDescription } // Gets the html/js to display in the UI for the logging endpoint. func getLoggingDescription() string { componentLevels := logging.GetComponentLevels() // Build component selector var componentSelector strings.Builder componentSelector.WriteString(``) // Build level selector var levelSelector strings.Builder levelSelector.WriteString(``) // Display current levels var currentLevelsDisplay strings.Builder currentLevelsDisplay.WriteString("

Current Levels:


") return currentLevelsDisplay.String() + `Set log level for a specific component.
Component: ` + componentSelector.String() + ` Level: ` + levelSelector.String() + ` ` }