Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: logdog/common/viewer/url.go

Issue 2456953003: LogDog: Update client/bootstrap to generate URLs. (Closed)
Patch Set: Better comments, use "url.URL". Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « logdog/client/cmd/logdog_butler/stream.go ('k') | logdog/common/viewer/url_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: logdog/common/viewer/url.go
diff --git a/logdog/common/viewer/url.go b/logdog/common/viewer/url.go
new file mode 100644
index 0000000000000000000000000000000000000000..a88f385486585fc95d867bc35b3e4ce965ea367b
--- /dev/null
+++ b/logdog/common/viewer/url.go
@@ -0,0 +1,31 @@
+// Copyright 2016 The LUCI Authors. All rights reserved.
+// Use of this source code is governed under the Apache License, Version 2.0
+// that can be found in the LICENSE file.
+
+// Package viewer is a support library to interact with the LogDog web app and
+// log stream viewer.
+package viewer
+
+import (
+ "fmt"
+ "net/url"
+
+ "github.com/luci/luci-go/common/config"
+ "github.com/luci/luci-go/logdog/common/types"
+)
+
+// GetURL generates a LogDog app viewer URL for the specified streams.
+func GetURL(host string, project config.ProjectName, paths ...types.StreamPath) string {
+ 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
+ for _, p := range paths {
+ query.Add("s", fmt.Sprintf("%s/%s", project, p))
+ }
+
+ u := url.URL{
+ Scheme: "https",
+ Host: host,
+ Path: "v/",
+ RawQuery: query.Encode(),
+ }
+ return u.String()
+}
« no previous file with comments | « logdog/client/cmd/logdog_butler/stream.go ('k') | logdog/common/viewer/url_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698