| Index: client/internal/logdog/butler/butler.go
|
| diff --git a/client/internal/logdog/butler/butler.go b/client/internal/logdog/butler/butler.go
|
| index 8b580d85b7a0af3ee36640b416389897e90851fb..8b0684a451f56183d2a0f2ab7153d2473970aba6 100644
|
| --- a/client/internal/logdog/butler/butler.go
|
| +++ b/client/internal/logdog/butler/butler.go
|
| @@ -17,6 +17,7 @@ import (
|
| "github.com/luci/luci-go/client/internal/logdog/butler/streamserver"
|
| "github.com/luci/luci-go/client/logdog/butlerlib/streamproto"
|
| "github.com/luci/luci-go/common/clock"
|
| + "github.com/luci/luci-go/common/config"
|
| "github.com/luci/luci-go/common/iotools"
|
| "github.com/luci/luci-go/common/logdog/types"
|
| log "github.com/luci/luci-go/common/logging"
|
| @@ -46,8 +47,14 @@ type Config struct {
|
| // OutputWorkers is the number of simultaneous goroutines that will be used
|
| // to output Butler log data. If zero, DefaultOutputWorkers will be used.
|
| OutputWorkers int
|
| +
|
| + // Project is the project that the log stream will be bound to.
|
| + Project config.ProjectName
|
| // Prefix is the log stream common prefix value.
|
| Prefix types.StreamName
|
| + // Secret is the prefix secret that will be used for streams generated by this
|
| + // Butler.
|
| + Secret types.PrefixSecret
|
|
|
| // BufferLogs, if true, instructs the butler to buffer collected log data
|
| // before sending it to Output.
|
| @@ -71,8 +78,18 @@ func (c *Config) Validate() error {
|
| if c.Output == nil {
|
| return errors.New("butler: an Output must be supplied")
|
| }
|
| + // TODO(dnj): Empty project should not validate here once projects are
|
| + // mandatory.
|
| + if c.Project != "" {
|
| + if err := c.Project.Validate(); err != nil {
|
| + return fmt.Errorf("invalid project: %v", err)
|
| + }
|
| + }
|
| if err := c.Prefix.Validate(); err != nil {
|
| - return errors.New("butler: invalid Prefix")
|
| + return fmt.Errorf("invalid prefix: %v", err)
|
| + }
|
| + if err := c.Secret.Validate(); err != nil {
|
| + return fmt.Errorf("invalid secret: %v", err)
|
| }
|
| return nil
|
| }
|
| @@ -135,6 +152,9 @@ func New(ctx context.Context, config Config) (*Butler, error) {
|
|
|
| bc := bundler.Config{
|
| Clock: clock.Get(ctx),
|
| + Project: config.Project,
|
| + Prefix: config.Prefix,
|
| + Secret: config.Secret,
|
| MaxBufferedBytes: streamBufferSize,
|
| MaxBundleSize: config.Output.MaxSize(),
|
| }
|
|
|