From 7e32f63216a67d48b2d9291a42ebbb63846aea8f Mon Sep 17 00:00:00 2001 From: cynic Date: Thu, 8 Aug 2024 15:03:35 +0000 Subject: [PATCH] better logging --- cmd/whoami/main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/whoami/main.go b/cmd/whoami/main.go index 86d3ff2..2e3eaba 100644 --- a/cmd/whoami/main.go +++ b/cmd/whoami/main.go @@ -39,11 +39,12 @@ func handler(w http.ResponseWriter, r *http.Request) { if parsedIP.To4() == nil { if (showIP) { w.Write([]byte(ip + "\n")) + log.Println(ip) } 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 { // set the response status code to 422 w.WriteHeader(http.StatusUnprocessableEntity)