summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-31 04:19:43 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-31 04:19:43 -0400
commitb961a7041ef6dbfd46371d0c626fd7d26b59c23d (patch)
tree935214d679dd1857c430e6ee5058d2e5b9ddd9a9
parent686b6db06566fe151b627d238e47705109181b31 (diff)
downloadgetwtxt-b961a7041ef6dbfd46371d0c626fd7d26b59c23d.tar.gz
bugfix: errors logged as strings (prev. bytes)
-rw-r--r--cache.go18
-rw-r--r--post.go4
-rw-r--r--query.go2
3 files changed, 12 insertions, 12 deletions
diff --git a/cache.go b/cache.go
index 6e58956..3a7886e 100644
--- a/cache.go
+++ b/cache.go
@@ -38,7 +38,7 @@ func cacheAndPush() {
 		}
 		if checkDBtime() {
 			if err := pushDatabase(); err != nil {
-				log.Printf("Error pushing cache to database: %v\n", err)
+				log.Printf("Error pushing cache to database: %v\n", err.Error())
 			}
 		}
 	}
@@ -56,7 +56,7 @@ func refreshCache() {
 		twtxtCache.Mu.RUnlock()
 		err := twtxtCache.UpdateUser(k)
 		if err != nil {
-			log.Printf("%v\n", err)
+			log.Printf("%v\n", err.Error())
 		}
 		twtxtCache.Mu.RLock()
 	}
@@ -66,7 +66,7 @@ func refreshCache() {
 	for _, v := range remoteRegistries.List {
 		err := twtxtCache.CrawlRemoteRegistry(v)
 		if err != nil {
-			log.Printf("Error while refreshing local copy of remote registry user data: %v\n", err)
+			log.Printf("Error while refreshing local copy of remote registry user data: %v\n", err.Error())
 		}
 	}
 	remoteRegistries.Mu.RUnlock()
@@ -152,7 +152,7 @@ func pullDatabase() {
 		case "Status":
 			thetime, err := time.Parse(time.RFC3339, split[2])
 			if err != nil {
-				log.Printf("%v\n", err)
+				log.Printf("%v\n", err.Error())
 			}
 			data.Status[thetime] = val
 		}
@@ -170,7 +170,7 @@ func pullDatabase() {
 	iter.Release()
 	err := iter.Error()
 	if err != nil {
-		log.Printf("Error while pulling DB into registry cache: %v\n", err)
+		log.Printf("Error while pulling DB into registry cache: %v\n", err.Error())
 	}
 }
 
@@ -181,12 +181,12 @@ func pingAssets() {
 
 	cssStat, err := os.Stat("assets/style.css")
 	if err != nil {
-		log.Printf("%v\n", err)
+		log.Printf("%v\n", err.Error())
 	}
 
 	indexStat, err := os.Stat("assets/tmpl/index.html")
 	if err != nil {
-		log.Printf("%v\n", err)
+		log.Printf("%v\n", err.Error())
 	}
 
 	indexMod := staticCache.indexMod
@@ -202,7 +202,7 @@ func pingAssets() {
 		err = tmpls.ExecuteTemplate(buf, "index.html", confObj.Instance)
 		confObj.Mu.RUnlock()
 		if err != nil {
-			log.Printf("%v\n", err)
+			log.Printf("%v\n", err.Error())
 		}
 
 		staticCache.index = buf.Bytes()
@@ -213,7 +213,7 @@ func pingAssets() {
 
 		css, err := ioutil.ReadFile("assets/style.css")
 		if err != nil {
-			log.Printf("%v\n", err)
+			log.Printf("%v\n", err.Error())
 		}
 
 		staticCache.css = css
diff --git a/post.go b/post.go
index ae1ef26..7846c7e 100644
--- a/post.go
+++ b/post.go
@@ -49,7 +49,7 @@ func apiPostUser(w http.ResponseWriter, r *http.Request) {
 
 	statuses, err := registry.ParseUserTwtxt(out, nick, urls)
 	if err != nil {
-		log.Printf("Error Parsing User Data: %v\n", err)
+		log.Printf("Error Parsing User Data: %v\n", err.Error())
 	}
 
 	if err := twtxtCache.AddUser(nick, urls, uip, statuses); err != nil {
@@ -60,6 +60,6 @@ func apiPostUser(w http.ResponseWriter, r *http.Request) {
 	log200(r)
 	_, err = w.Write([]byte(fmt.Sprintf("200 OK\n")))
 	if err != nil {
-		log.Printf("%v\n", err)
+		log.Printf("%v\n", err.Error())
 	}
 }
diff --git a/query.go b/query.go
index 6b9792b..554a53c 100644
--- a/query.go
+++ b/query.go
@@ -13,7 +13,7 @@ import (
 func apiErrCheck(err error, r *http.Request) {
 	if err != nil {
 		uip := getIPFromCtx(r.Context())
-		log.Printf("*** %v :: %v %v :: %v\n", uip, r.Method, r.URL, err)
+		log.Printf("*** %v :: %v %v :: %v\n", uip, r.Method, r.URL, err.Error())
 	}
 }