From 0400c2f4062ef3bc07c78f37d32f4b516936eaa4 Mon Sep 17 00:00:00 2001 From: Mike Cheng Date: Tue, 5 May 2015 11:07:59 -0400 Subject: [PATCH] Update logging / comment semantics about DNSRecord.Name --- api/api.go | 5 ++--- dyndns/daemon.go | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/api/api.go b/api/api.go index ba41cea..7f49ebd 100644 --- a/api/api.go +++ b/api/api.go @@ -77,9 +77,8 @@ func (api API) performRequest(method, url string, body io.Reader) (response []by return ioutil.ReadAll(resp.Body) } -// Create a DNS record for a given domain. The hostname is -// specified in the DNSRecord under name, and should not -// include the domain. +// Create a DNS record for a given domain. The name +// field in DNSRecord is in the format [hostname].[domainname] func (api API) CreateDNSRecord(domain string, record DNSRecord) error { b, err := json.Marshal(record) if err != nil { diff --git a/dyndns/daemon.go b/dyndns/daemon.go index 41d54ff..ebc42de 100644 --- a/dyndns/daemon.go +++ b/dyndns/daemon.go @@ -12,13 +12,13 @@ import ( var wg sync.WaitGroup func updateDNSRecord(a api.API, domain, recordId string, newRecord api.DNSRecord) error { - log.Logger.Printf("Deleting DNS record for %s.%s.\n", newRecord.Name, domain) + log.Logger.Printf("Deleting DNS record for %s.\n", newRecord.Name) err := a.DeleteDNSRecord(domain, newRecord.RecordId) if err != nil { return err } - log.Logger.Printf("Creating DNS record for %s.%s: %s\n", newRecord.Name, domain, newRecord) + log.Logger.Printf("Creating DNS record for %s: %s\n", newRecord.Name, newRecord) return a.CreateDNSRecord(domain, newRecord) } @@ -63,9 +63,9 @@ func runConfig(c api.Config, daemon bool) { r.Content = ip err = updateDNSRecord(a, c.Domain, r.RecordId, r) if err != nil { - log.Logger.Printf("Failed to update record %s [%s.%s] with IP: %s\n\t%s\n", r.RecordId, r.Name, c.Domain, ip, err) + log.Logger.Printf("Failed to update record %s [%s] with IP: %s\n\t%s\n", r.RecordId, r.Name, ip, err) } else { - log.Logger.Printf("Attempting to update record %s [%s.%s] with IP: %s\n", r.RecordId, r.Name, c.Domain, ip) + log.Logger.Printf("Attempting to update record %s [%s] with IP: %s\n", r.RecordId, r.Name, ip) } } }