| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 package client | 5 package client | 
| 6 | 6 | 
| 7 import ( | 7 import ( | 
| 8         "encoding/json" | 8         "encoding/json" | 
| 9         "fmt" | 9         "fmt" | 
| 10         "io/ioutil" | 10         "io/ioutil" | 
| 11         "net/http" | 11         "net/http" | 
| 12         "net/url" | 12         "net/url" | 
| 13         "strings" | 13         "strings" | 
| 14         "sync/atomic" | 14         "sync/atomic" | 
| 15 | 15 | 
| 16 »       "github.com/Sirupsen/logrus" | 16 »       "infra/libs/logging" | 
| 17 | 17 | 
| 18         "infra/monitoring/messages" | 18         "infra/monitoring/messages" | 
| 19 ) | 19 ) | 
| 20 | 20 | 
| 21 var ( | 21 var ( | 
| 22 »       log = logrus.New() | 22 »       log = logging.DefaultLogger | 
| 23 ) | 23 ) | 
| 24 | 24 | 
| 25 // MasterURL returns the builder URL for the given master. | 25 // MasterURL returns the builder URL for the given master. | 
| 26 func MasterURL(master string) string { | 26 func MasterURL(master string) string { | 
| 27         return fmt.Sprintf("https://build.chromium.org/p/%s", master) | 27         return fmt.Sprintf("https://build.chromium.org/p/%s", master) | 
| 28 } | 28 } | 
| 29 | 29 | 
| 30 // BuilderURL returns the builder URL for the given master and builder. | 30 // BuilderURL returns the builder URL for the given master and builder. | 
| 31 func BuilderURL(master, builder string) string { | 31 func BuilderURL(master, builder string) string { | 
| 32         return fmt.Sprintf("https://build.chromium.org/p/%s/builders/%s", master
     , oldEscape(builder)) | 32         return fmt.Sprintf("https://build.chromium.org/p/%s/builders/%s", master
     , oldEscape(builder)) | 
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 270                 log.Infof("Fetched(%d) text: %s", resp.StatusCode, url) | 270                 log.Infof("Fetched(%d) text: %s", resp.StatusCode, url) | 
| 271                 return length, err | 271                 return length, err | 
| 272         }) | 272         }) | 
| 273         return ret, status, nil | 273         return ret, status, nil | 
| 274 } | 274 } | 
| 275 | 275 | 
| 276 func (c *client) DumpStats() { | 276 func (c *client) DumpStats() { | 
| 277         log.Infof("%d reqs total, %d errors, %d current", c.totalReqs, c.totalEr
     rs, c.currReqs) | 277         log.Infof("%d reqs total, %d errors, %d current", c.totalReqs, c.totalEr
     rs, c.currReqs) | 
| 278         log.Infof("%d bytes read", c.totalBytes) | 278         log.Infof("%d bytes read", c.totalBytes) | 
| 279 } | 279 } | 
| OLD | NEW | 
|---|