better logging

This commit is contained in:
cynic 2024-08-08 15:03:35 +00:00
parent 507b16fbd0
commit 7e32f63216

View File

@ -39,11 +39,12 @@ func handler(w http.ResponseWriter, r *http.Request) {
if parsedIP.To4() == nil {
if (showIP) {
w.Write([]byte(ip + "\n"))
} else {
w.Write([]byte(domainFromIP(parsedIP) + "\n"))
}
log.Println(showIP)
log.Println(ip)
} else {
domain := domainFromIP(parsedIP)
w.Write([]byte(domain + "\n"))
log.Println(domain)
}
} else {
// set the response status code to 422
w.WriteHeader(http.StatusUnprocessableEntity)