~chipaca/ubuntu-push/lots-of-small-logging-changes

« back to all changes in this revision

Viewing changes to bus/connectivity/webchecker.go

  • Committer: John R. Lenton
  • Date: 2015-01-21 17:21:42 UTC
  • Revision ID: jlenton@gmail.com-20150121172142-tzryfmb0w29fu3ve
lots of small logging changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
func (wb *webchecker) Webcheck(ch chan<- bool) {
65
65
        response, err := wb.cli.Get(wb.url)
66
66
        if err != nil {
67
 
                wb.log.Errorf("While GETting %s: %v", wb.url, err)
 
67
                wb.log.Errorf("while GETting %s: %v", wb.url, err)
68
68
                ch <- false
69
69
                return
70
70
        }
72
72
        hash := md5.New()
73
73
        _, err = io.CopyN(hash, response.Body, 1024)
74
74
        if err != io.EOF {
75
 
                wb.log.Errorf("Reading %s, expecting EOF, got: %v",
 
75
                wb.log.Errorf("reading %s, expecting EOF, got: %v",
76
76
                        wb.url, err)
77
77
                ch <- false
78
78
                return
79
79
        }
80
80
        sum := fmt.Sprintf("%x", hash.Sum(nil))
81
81
        if sum == wb.target {
82
 
                wb.log.Infof("Connectivity check passed.")
 
82
                wb.log.Infof("connectivity check passed.")
83
83
                ch <- true
84
84
        } else {
85
 
                wb.log.Infof("Connectivity check failed: content mismatch.")
 
85
                wb.log.Infof("connectivity check failed: content mismatch.")
86
86
                ch <- false
87
87
        }
88
88
}