Browse Source

Reduce logging in dqlite

pull/1045/head
Darren Shepherd 5 years ago
parent
commit
b2439788d7
  1. 8
      pkg/dqlite/log.go
  2. 4
      pkg/dqlite/pipe/pipe.go

8
pkg/dqlite/log.go

@ -1,6 +1,8 @@
package dqlite
import (
"strings"
"github.com/canonical/go-dqlite/client"
"github.com/sirupsen/logrus"
)
@ -13,7 +15,11 @@ func log() client.LogFunc {
case client.LogError:
logrus.Errorf(s, i...)
case client.LogInfo:
logrus.Infof(s, i...)
if strings.HasPrefix(s, "connected") {
logrus.Debugf(s, i...)
} else {
logrus.Infof(s, i...)
}
case client.LogWarn:
logrus.Warnf(s, i...)
}

4
pkg/dqlite/pipe/pipe.go

@ -29,7 +29,7 @@ func Connect(src net.Conn, dst net.Conn) {
go func() {
_, err := io.Copy(eagain.Writer{Writer: dst}, eagain.Reader{Reader: src})
if err != nil && err != io.EOF {
logrus.Warnf("copy pipe src->dst closed: %v", err)
logrus.Debugf("copy pipe src->dst closed: %v", err)
}
src.Close()
dst.Close()
@ -38,7 +38,7 @@ func Connect(src net.Conn, dst net.Conn) {
go func() {
_, err := io.Copy(eagain.Writer{Writer: src}, eagain.Reader{Reader: dst})
if err != nil {
logrus.Warnf("copy pipe dst->src closed: %v", err)
logrus.Debugf("copy pipe dst->src closed: %v", err)
}
src.Close()
dst.Close()

Loading…
Cancel
Save