Expose log output writer
This commit is contained in:
parent
734d33365a
commit
9ac25647ad
@ -6,7 +6,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ func (conn *KafkaConn) Send(msg string) error {
|
|||||||
conn.t = time.Now()
|
conn.t = time.Now()
|
||||||
|
|
||||||
if log.Level > 2 {
|
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)
|
uri := fmt.Sprintf("%s:%d", conn.ep.Kafka.Host, conn.ep.Kafka.Port)
|
||||||
|
@ -32,6 +32,11 @@ func init() {
|
|||||||
SetOutput(os.Stderr)
|
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{}) {
|
func log(level int, tag, color string, formatted bool, format string, args ...interface{}) {
|
||||||
if Level < level {
|
if Level < level {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user