Logging: Add some error output

This commit is contained in:
Joel Elkins 2023-03-30 18:03:54 -05:00
parent a364ae174e
commit 9b2fc18775
Signed by: joel
GPG Key ID: 133589DC38921AE2
1 changed files with 5 additions and 0 deletions

View File

@ -89,6 +89,7 @@ func doSetCur(w http.ResponseWriter, r *http.Request) {
if !found {
w.WriteHeader(404)
fmt.Fprintf(w, "Target %s not found", tgt)
log.Printf("setcur: target %s not configured", tgt)
}
}
@ -164,6 +165,10 @@ func doSwitch(dir bool, tgt string, w http.ResponseWriter) {
}
if len(errs) > 0 {
w.WriteHeader(503)
log.Printf("Switch resulted in %d errors:", len(errs))
for i, e := range errs {
log.Printf("[%d/%d]: %s", i, len(errs), e)
}
}
for _, o := range res {
fmt.Fprint(w, o)