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 parsedIP.To4() == nil {
if (showIP) { if (showIP) {
w.Write([]byte(ip + "\n")) w.Write([]byte(ip + "\n"))
log.Println(ip)
} else { } else {
w.Write([]byte(domainFromIP(parsedIP) + "\n")) domain := domainFromIP(parsedIP)
w.Write([]byte(domain + "\n"))
log.Println(domain)
} }
log.Println(showIP)
log.Println(ip)
} else { } else {
// set the response status code to 422 // set the response status code to 422
w.WriteHeader(http.StatusUnprocessableEntity) w.WriteHeader(http.StatusUnprocessableEntity)