fmt -> log
Jes Olson j3s@c3f.net
Sat, 13 May 2023 23:00:11 -0700
3 files changed,
9 insertions(+),
8 deletions(-)
M
main.go
→
main.go
@@ -1,7 +1,7 @@
package main import ( - "fmt" + "log" "net/http" )@@ -16,6 +16,6 @@ mux.HandleFunc("/login", s.loginHandler)
mux.HandleFunc("/logout", s.logoutHandler) mux.HandleFunc("/register", s.registerHandler) - fmt.Println("main: listening on http://localhost:5544") - panic(http.ListenAndServe(":5544", mux)) + log.Println("main: listening on http://localhost:5544") + log.Fatal(http.ListenAndServe(":5544", mux)) }
M
reaper/reaper.go
→
reaper/reaper.go
@@ -1,7 +1,7 @@
package reaper import ( - "fmt" + "log" "sort" "sync" "time"@@ -70,7 +70,7 @@ }(r.feeds[i])
} } wg.Wait() - fmt.Printf("reaper: refresh complete in %s\n", time.Since(start)) + log.Printf("reaper: refresh complete in %s\n", time.Since(start)) } // refreshFeed triggers a fetch on the given feed,@@ -83,10 +83,10 @@ }
} func (r *Reaper) handleFeedFetchFailure(url string, err error) { - fmt.Printf("[err] reaper: fetch failure '%s': %s\n", url, err) + log.Printf("[err] reaper: fetch failure '%s': %s\n", url, err) err = r.db.SetFeedFetchError(url, err.Error()) if err != nil { - fmt.Printf("[err] reaper: could not set feed fetch error '%s'\n", err) + log.Printf("[err] reaper: could not set feed fetch error '%s'\n", err) } }
M
site.go
→
site.go
@@ -3,6 +3,7 @@
import ( "fmt" "io/ioutil" + "log" "math/rand" "net/http" "net/url"@@ -354,7 +355,7 @@ prefix = "(╥﹏╥) oopsie woopsie, uwu\n"
prefix += "we made a fucky wucky (╥﹏╥)\n\n" prefix += "500 internal server error\n" } - fmt.Println(prefix + error) + log.Println(prefix + error) http.Error(w, prefix+error, code) }