Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | |
| 3 // that can be found in the LICENSE file. | |
| 4 | |
| 5 // Package viewer is a support library to interact with the LogDog web app and | |
| 6 // log stream viewer. | |
| 7 package viewer | |
| 8 | |
| 9 import ( | |
| 10 "fmt" | |
| 11 "net/url" | |
| 12 | |
| 13 "github.com/luci/luci-go/common/config" | |
| 14 "github.com/luci/luci-go/logdog/common/types" | |
| 15 ) | |
| 16 | |
| 17 // GetURL generates a LogDog app viewer URL for the specified streams. | |
| 18 func GetURL(host string, project config.ProjectName, paths ...types.StreamPath) string { | |
| 19 query := make(url.Values, len(paths)) | |
|
Vadim Sh.
2016/10/28 03:56:53
nit: len(paths) here is harmful.
url.Values is ma
dnj
2016/10/28 04:00:10
Hah you're right, didn't occur to me that every ke
| |
| 20 for _, p := range paths { | |
| 21 query.Add("s", fmt.Sprintf("%s/%s", project, p)) | |
| 22 } | |
| 23 | |
| 24 u := url.URL{ | |
| 25 Scheme: "https", | |
| 26 Host: host, | |
| 27 Path: "v/", | |
| 28 RawQuery: query.Encode(), | |
| 29 } | |
| 30 return u.String() | |
| 31 } | |
| OLD | NEW |