Skip to content

Commit

Permalink
Merge pull request #44 from AccelByte/remove-logmode-config
Browse files Browse the repository at this point in the history
fix: remove logmode config that impacting global log level
  • Loading branch information
fadhillahentino committed Mar 25, 2022
2 parents 2d1f890 + d031b94 commit e02bfd9
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 22 deletions.
1 change: 0 additions & 1 deletion eventstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ type Event struct {

// BrokerConfig is custom configuration for message broker
type BrokerConfig struct {
LogMode string
StrictValidation bool
CACertFile string
DialTimeout time.Duration
Expand Down
1 change: 0 additions & 1 deletion example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
// nolint: funlen
func main() {
config := &eventstream.BrokerConfig{
LogMode: eventstream.InfoLevel,
StrictValidation: true,
DialTimeout: 0,
ReadTimeout: 0,
Expand Down
18 changes: 0 additions & 18 deletions kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"sync"
"time"

Expand Down Expand Up @@ -106,26 +105,9 @@ func setConfig(writerConfig *kafka.WriterConfig, readerConfig *kafka.ReaderConfi
readerConfig.Dialer = dialer
}

setLogLevel(config.LogMode)

return nil
}

func setLogLevel(logMode string) {
switch logMode {
case DebugLevel:
logrus.SetLevel(logrus.DebugLevel)
case InfoLevel:
logrus.SetLevel(logrus.InfoLevel)
case WarnLevel:
logrus.SetLevel(logrus.WarnLevel)
case ErrorLevel:
logrus.SetLevel(logrus.ErrorLevel)
default:
logrus.SetOutput(ioutil.Discard)
}
}

// newKafkaClient create a new instance of KafkaClient
func newKafkaClient(brokers []string, prefix string, config ...*BrokerConfig) (*KafkaClient, error) {
logrus.Info("create new kafka client")
Expand Down
2 changes: 0 additions & 2 deletions kafka_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func createKafkaClient(t *testing.T) Client {

config := &BrokerConfig{
CACertFile: "",
LogMode: DebugLevel,
StrictValidation: true,
DialTimeout: time.Second,
ReadTimeout: time.Second,
Expand All @@ -67,7 +66,6 @@ func createInvalidKafkaClient(t *testing.T) Client {

config := &BrokerConfig{
CACertFile: "",
LogMode: DebugLevel,
StrictValidation: true,
DialTimeout: time.Second,
ReadTimeout: time.Second,
Expand Down

0 comments on commit e02bfd9

Please sign in to comment.