From 1247847e9a889a163df1e85f661e7c566e2d804e Mon Sep 17 00:00:00 2001 From: phga Date: Wed, 2 Jun 2021 14:59:15 +0200 Subject: [PATCH] feat: more logging info + loglevel --- cmd/dd/config.go | 1 + cmd/dd/dd.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/cmd/dd/config.go b/cmd/dd/config.go index 1b4f0e1..16fd37d 100644 --- a/cmd/dd/config.go +++ b/cmd/dd/config.go @@ -18,6 +18,7 @@ type Config struct { DdUsers map[string]map[string]string `json:"dd_users"` DnsTTL int `json:"dns_ttl"` DnsServer string `json:"dns_server"` + Loglevel string `json:"loglevel"` } var config Config diff --git a/cmd/dd/dd.go b/cmd/dd/dd.go index 2f7fd9a..01ae813 100644 --- a/cmd/dd/dd.go +++ b/cmd/dd/dd.go @@ -22,6 +22,10 @@ func handleDynamicUpdate(w http.ResponseWriter, r *http.Request) { up := r.URL.Query() ip := r.Header.Get("X-FORWARDED-FOR") + if config.Loglevel == "verbose" { + log.Println(up, ip) + } + if len(ip) < 1 { ip = strings.Split(r.RemoteAddr, ":")[0] }