Skip to content

Commit

Permalink
feat: print kafka config
Browse files Browse the repository at this point in the history
  • Loading branch information
erayarslan committed Sep 5, 2024
1 parent debfa04 commit e28143e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions connector.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package dcpkafka

import (
"bytes"
"encoding/json"
"errors"
"fmt"
"os"

jsoniter "github.com/json-iterator/go"

dcpCouchbase "github.com/Trendyol/go-dcp/couchbase"

"github.com/Trendyol/go-dcp/helpers"
Expand Down Expand Up @@ -142,6 +146,9 @@ func newConnector(cfg any, mapper Mapper, sinkResponseHandler kafka.SinkResponse
return nil, err
}

copyOfConfig := c.Kafka
printConfiguration(copyOfConfig)

conf := dcpClient.GetConfig()
conf.Checkpoint.Type = "manual"

Expand Down Expand Up @@ -260,3 +267,16 @@ func (c *ConnectorBuilder) SetLogger(l *logrus.Logger) *ConnectorBuilder {
}
return c
}

func printConfiguration(config config.Kafka) {
config.ScramPassword = "*****"
configJSON, _ := jsoniter.Marshal(config)

dst := &bytes.Buffer{}
if err := json.Compact(dst, configJSON); err != nil {
logger.Log.Error("error while print kafka configuration, err: %v", err)
panic(err)
}

logger.Log.Info("using kafka config: %v", dst.String())
}

0 comments on commit e28143e

Please sign in to comment.