Enable filtering by debug and automatic scroll to bottom

This commit is contained in:
2021-06-06 17:15:38 +09:30
parent 71c097e578
commit cc54bb6469
2 changed files with 50 additions and 6 deletions

View File

@@ -274,8 +274,17 @@ func getSetExclude(w http.ResponseWriter, r *http.Request) {
func getLogs(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
showDebug := false
debug, present := r.URL.Query()["debug"]
if present && len(debug[0]) > 0 && debug[0] != "0" {
showDebug = true
}
text := ""
for _, log := range daulog.LogEntries {
if !showDebug && log.Type == daulog.LogTypeDebug {
continue
}
text = text + fmt.Sprintf(
"%-6s %-19s %s\n", log.Type, log.Timestamp.Format("2006-01-02 15:04:05"), log.Entry,
)