Commit b2439788 authored by Darren Shepherd's avatar Darren Shepherd

Reduce logging in dqlite

parent 0ae20eb7
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...)
}
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment