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 "strings" | |
| 13 | |
| 14 "github.com/luci/luci-go/common/config" | |
| 15 "github.com/luci/luci-go/logdog/common/types" | |
| 16 ) | |
| 17 | |
| 18 // GetURL generates a LogDog app viewer URL for the specified streams. | |
| 19 func GetURL(host string, project config.ProjectName, paths ...types.StreamPath) string { | |
| 20 pathQueries := make([]string, len(paths)) | |
|
Vadim Sh.
2016/10/27 23:50:05
nit: use https://golang.org/pkg/net/url/#Values.Ad
dnj
2016/10/28 00:01:45
Oh shoot, I can't believe I forgot about this. Don
| |
| 21 for i, p := range paths { | |
| 22 pathQueries[i] = fmt.Sprintf("s=%s", url.QueryEscape(fmt.Sprintf ("%s/%s", project, p))) | |
| 23 } | |
| 24 | |
| 25 return fmt.Sprintf("https://%s/v/?%s", host, strings.Join(pathQueries, " &")) | |
| 26 } | |
| OLD | NEW |