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

Unified Diff: client/cmd/logdog_cat/main.go

Issue 1916013002: LogDog: Add project namespacing to `logdog_cat` (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-collector-butler
Patch Set: Rebase, project UI. Created 4 years, 8 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 | « no previous file | common/logdog/coordinator/client.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cmd/logdog_cat/main.go
diff --git a/client/cmd/logdog_cat/main.go b/client/cmd/logdog_cat/main.go
index 3faf3ec4b1a98868c9f81c59ea0c5b15f20dcc72..9186c9b899c4481afc87dc9bfccabade5f748ae2 100644
--- a/client/cmd/logdog_cat/main.go
+++ b/client/cmd/logdog_cat/main.go
@@ -7,6 +7,7 @@ package main
import (
"errors"
"flag"
+ "fmt"
"os"
"os/signal"
@@ -16,6 +17,7 @@ import (
"github.com/luci/luci-go/client/authcli"
"github.com/luci/luci-go/common/auth"
"github.com/luci/luci-go/common/cli"
+ "github.com/luci/luci-go/common/config"
"github.com/luci/luci-go/common/logdog/coordinator"
log "github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/common/logging/gologger"
@@ -30,6 +32,7 @@ type application struct {
cli.Application
context.Context
+ project config.ProjectName
authFlags authcli.Flags
coordinator string
insecure bool
@@ -42,12 +45,20 @@ func (a *application) addToFlagSet(ctx context.Context, fs *flag.FlagSet) {
"The LogDog Coordinator [host][:port].")
fs.BoolVar(&a.insecure, "insecure", false,
"Use insecure transport for RPC.")
+ fs.Var(&a.project, "project",
+ "The log stream's project.")
}
func (a *application) validate() error {
if a.coordinator == "" {
return errors.New("main: missing coordinator URL (-url)")
}
+ // TODO(dnj): Error on empty project once that's disallowed.
+ if a.project != "" {
+ if err := a.project.Validate(); err != nil {
+ return fmt.Errorf("main: invalid project name (-project): %s", err)
+ }
+ }
return nil
}
@@ -128,7 +139,7 @@ func mainImpl() int {
log.Errorf(log.SetError(ctx, err), "Failed to create auth options.")
return 1
}
- httpClient, err := auth.NewAuthenticator(ctx, auth.SilentLogin, authOpts).Client()
+ httpClient, err := auth.NewAuthenticator(ctx, auth.OptionalLogin, authOpts).Client()
if err != nil {
log.Errorf(log.SetError(ctx, err), "Failed to create authenticated client.")
return 1
@@ -142,7 +153,7 @@ func mainImpl() int {
}
prpcClient.Options.Insecure = a.insecure
- a.coord = coordinator.NewClient(prpcClient)
+ a.coord = coordinator.NewClient(prpcClient, a.project)
a.Context = ctx
return subcommands.Run(&a, flags.Args())
}
« no previous file with comments | « no previous file | common/logdog/coordinator/client.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698