mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
28 lines
514 B
Go
28 lines
514 B
Go
package dqlite
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/canonical/go-dqlite/client"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func log() client.LogFunc {
|
|
return func(level client.LogLevel, s string, i ...interface{}) {
|
|
switch level {
|
|
case client.LogDebug:
|
|
logrus.Debugf(s, i...)
|
|
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...)
|
|
}
|
|
}
|
|
}
|