diff --git a/internal/endpoint/kafka.go b/internal/endpoint/kafka.go index 9f0e1df2..4698e788 100644 --- a/internal/endpoint/kafka.go +++ b/internal/endpoint/kafka.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "io/ioutil" - "os" "sync" "time" @@ -61,7 +60,7 @@ func (conn *KafkaConn) Send(msg string) error { conn.t = time.Now() if log.Level > 2 { - sarama.Logger = lg.New(os.Stdout, "[sarama] ", lg.LstdFlags) + sarama.Logger = lg.New(log.Output(), "[sarama] ", 0) } uri := fmt.Sprintf("%s:%d", conn.ep.Kafka.Host, conn.ep.Kafka.Port) diff --git a/internal/log/log.go b/internal/log/log.go index 80abb7ea..eaebf044 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -32,6 +32,11 @@ func init() { SetOutput(os.Stderr) } +// Output retuns the output writer +func Output() io.Writer { + return wr +} + func log(level int, tag, color string, formatted bool, format string, args ...interface{}) { if Level < level { return