From 1a66461e07eb69e991198428d461c68ee7c5e442 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sun, 17 Aug 2014 10:28:36 +0200 Subject: [PATCH] All printed warnings should have some context --- cmd/syncthing/gui.go | 8 ++++---- cmd/syncthing/gui_solaris.go | 2 +- config/config.go | 2 +- versioner/simple.go | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index 9c46115a..698682c9 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -278,7 +278,7 @@ func restPostConfig(m *model.Model, w http.ResponseWriter, r *http.Request) { var newCfg config.Configuration err := json.NewDecoder(r.Body).Decode(&newCfg) if err != nil { - l.Warnln(err) + l.Warnln("decoding posted config:", err) http.Error(w, err.Error(), 500) return } else { @@ -289,7 +289,7 @@ func restPostConfig(m *model.Model, w http.ResponseWriter, r *http.Request) { } else { hash, err := bcrypt.GenerateFromPassword([]byte(newCfg.GUI.Password), 0) if err != nil { - l.Warnln(err) + l.Warnln("bcrypting password:", err) http.Error(w, err.Error(), 500) return } else { @@ -513,7 +513,7 @@ func restGetLang(w http.ResponseWriter, r *http.Request) { func restPostUpgrade(w http.ResponseWriter, r *http.Request) { rel, err := upgrade.LatestRelease(strings.Contains(Version, "-beta")) if err != nil { - l.Warnln(err) + l.Warnln("getting latest release:", err) http.Error(w, err.Error(), 500) return } @@ -521,7 +521,7 @@ func restPostUpgrade(w http.ResponseWriter, r *http.Request) { if upgrade.CompareVersions(rel.Tag, Version) == 1 { err = upgrade.UpgradeTo(rel, GoArchExtra) if err != nil { - l.Warnln(err) + l.Warnln("upgrading:", err) http.Error(w, err.Error(), 500) return } diff --git a/cmd/syncthing/gui_solaris.go b/cmd/syncthing/gui_solaris.go index 18872ef1..5b2af308 100644 --- a/cmd/syncthing/gui_solaris.go +++ b/cmd/syncthing/gui_solaris.go @@ -79,7 +79,7 @@ func trackCPUUsage() { for _ = range time.NewTicker(time.Second).C { err := solarisPrusage(pid, &rusage) if err != nil { - l.Warnln(err) + l.Warnln("getting prusage:", err) continue } curTime := time.Now().UnixNano() diff --git a/config/config.go b/config/config.go index 3c69dc11..27bf2de2 100644 --- a/config/config.go +++ b/config/config.go @@ -315,7 +315,7 @@ func Load(rd io.Reader, myID protocol.NodeID) (Configuration, error) { if len(cfg.GUI.Password) > 0 && cfg.GUI.Password[0] != '$' { hash, err := bcrypt.GenerateFromPassword([]byte(cfg.GUI.Password), 0) if err != nil { - l.Warnln(err) + l.Warnln("bcrypting password:", err) } else { cfg.GUI.Password = string(hash) } diff --git a/versioner/simple.go b/versioner/simple.go index a3c2af03..3080a18a 100644 --- a/versioner/simple.go +++ b/versioner/simple.go @@ -96,7 +96,7 @@ func (v Simple) Archive(filePath string) error { versions, err := filepath.Glob(filepath.Join(dir, file+"~*")) if err != nil { - l.Warnln(err) + l.Warnln("globbing:", err) return nil } @@ -108,7 +108,7 @@ func (v Simple) Archive(filePath string) error { } err = os.Remove(toRemove) if err != nil { - l.Warnln(err) + l.Warnln("removing old version:", err) } } }