Reduce logging in dqlite

This commit is contained in:
Darren Shepherd 2019-11-11 22:18:43 +00:00
parent 0ae20eb7a3
commit b2439788d7
2 changed files with 9 additions and 3 deletions

View File

@ -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:
if strings.HasPrefix(s, "connected") {
logrus.Debugf(s, i...)
} else {
logrus.Infof(s, i...)
}
case client.LogWarn:
logrus.Warnf(s, i...)
}

View File

@ -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()