diff --git a/cli/cli.go b/cli/cli.go index 18e412c90..a8462a018 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -384,6 +384,7 @@ func (cmd *Command) setupConfig() error { cmd.kafkaRunner = kafka.NewRunner( cleanCfg, batch.NewSQLBatcher(cmd, kafka.ConfigToFields(cfg)), + cmd.Stderr, ) } diff --git a/cli/kafka/runner.go b/cli/kafka/runner.go index 739b2bd2b..17e2ba178 100644 --- a/cli/kafka/runner.go +++ b/cli/kafka/runner.go @@ -1,12 +1,14 @@ package kafka import ( + "io" "time" fbbatch "github.com/featurebasedb/featurebase/v3/batch" "github.com/featurebasedb/featurebase/v3/errors" "github.com/featurebasedb/featurebase/v3/idk" "github.com/featurebasedb/featurebase/v3/idk/kafka_static" + "github.com/featurebasedb/featurebase/v3/logger" ) type Runner struct { @@ -18,7 +20,7 @@ type Runner struct { Header []idk.RawField `help:"Header configuration."` } -func NewRunner(cfg ConfigForIDK, batcher fbbatch.Batcher) *Runner { +func NewRunner(cfg ConfigForIDK, batcher fbbatch.Batcher, logWriter io.Writer) *Runner { idkMain := idk.NewMain() idkMain.IDField = cfg.IDField idkMain.Index = cfg.Table @@ -26,6 +28,7 @@ func NewRunner(cfg ConfigForIDK, batcher fbbatch.Batcher) *Runner { idkMain.BatchSize = cfg.BatchSize idkMain.BatchMaxStaleness = cfg.BatchMaxStaleness idkMain.Basic() + idkMain.SetLog(logger.NewStandardLogger(logWriter)) kr := &Runner{ Main: *idkMain, diff --git a/idk/ingest.go b/idk/ingest.go index 385ff2889..208e806b0 100644 --- a/idk/ingest.go +++ b/idk/ingest.go @@ -216,8 +216,6 @@ func (m *Main) Log() logger.Logger { return m.log } func (m *Main) SetLog(log logger.Logger) { m.log = log } func NewMain() *Main { - fmt.Fprintf(os.Stderr, "Molecula Consumer %s, build time %s\n", Version, BuildTime) - return &Main{ PilosaHosts: []string{"localhost:10101"}, PilosaGRPCHosts: []string{"localhost:20101"}, @@ -254,6 +252,10 @@ func (m *Main) Basic() { } func (m *Main) Run() (err error) { + if !m.basic { + m.log.Printf("Molecula Consumer %s, build time %s\n", Version, BuildTime) + } + onFinishRun, err := m.Setup() if err != nil { return errors.Wrap(err, "setting up")