| Index: client/cmd/isolate/isolate_event_logger.go
|
| diff --git a/client/cmd/isolate/isolate_event_logger.go b/client/cmd/isolate/isolate_event_logger.go
|
| index 4878f1d4ac7894d542bd00c29f5b8856b5e1cbd9..1d424dc45fd71bf852096580bfb3041cdf2deaaf 100644
|
| --- a/client/cmd/isolate/isolate_event_logger.go
|
| +++ b/client/cmd/isolate/isolate_event_logger.go
|
| @@ -13,8 +13,31 @@ import (
|
| "github.com/golang/protobuf/proto"
|
| "github.com/luci/luci-go/common/eventlog"
|
| logpb "github.com/luci/luci-go/common/eventlog/proto"
|
| + "github.com/luci/luci-go/common/logging"
|
| )
|
|
|
| +// eventlogEndpoint returns a destination URL for eventlogs, based on the contents of
|
| +// the endpointFlag.
|
| +func eventlogEndpoint(ctx context.Context, endpointFlag string) string {
|
| + switch endpointFlag {
|
| + case "auto":
|
| + if autoEventlog() {
|
| + msg := "Automatically logging usage statistics to %s. If this is not desired, then set --eventlog-endpoint=none"
|
| + logging.Infof(ctx, msg, eventlog.ProdEndpoint)
|
| + return eventlog.ProdEndpoint
|
| + }
|
| + return ""
|
| + case "test":
|
| + return eventlog.TestEndpoint
|
| + case "prod":
|
| + return eventlog.ProdEndpoint
|
| + case "none":
|
| + return ""
|
| + default:
|
| + return endpointFlag
|
| + }
|
| +}
|
| +
|
| type syncLogger interface {
|
| LogSync(ctx context.Context, events ...*eventlog.ChromeInfraLogEvent) error
|
| NewLogEvent(ctx context.Context, eventTime eventlog.TypedTime) *eventlog.ChromeInfraLogEvent
|
| @@ -30,10 +53,11 @@ type IsolateEventLogger struct {
|
| }
|
|
|
| // NewLogger returns an IsolateEventLogger which logs to the specified endpoint.
|
| +// endpoint is the URL to which logs will be sent.
|
| func NewLogger(ctx context.Context, endpoint string) *IsolateEventLogger {
|
| l := &IsolateEventLogger{}
|
| - if host := eventlogEndpoint(endpoint); host != "" {
|
| - l.client = eventlog.NewClient(ctx, host)
|
| + if endpoint != "" {
|
| + l.client = eventlog.NewClient(ctx, endpoint)
|
| }
|
| return l
|
| }
|
| @@ -62,17 +86,6 @@ func (l *IsolateEventLogger) logStats(ctx context.Context, op *logpb.IsolateClie
|
| return l.client.LogSync(ctx, event)
|
| }
|
|
|
| -func eventlogEndpoint(endpointFlag string) string {
|
| - switch endpointFlag {
|
| - case "test":
|
| - return eventlog.TestEndpoint
|
| - case "prod":
|
| - return eventlog.ProdEndpoint
|
| - default:
|
| - return endpointFlag
|
| - }
|
| -}
|
| -
|
| // buildbotInfo contains information about the build in which this command was run.
|
| type buildbotInfo struct {
|
| // Variables which are not present in the environment are nil.
|
|
|