mirror of https://github.com/tidwall/tile38.git
Expose log output writer
This commit is contained in:
parent
248c3d8b72
commit
b64c87004f
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue