Config should take a Logger interface
lthibault opened this issue · 3 comments
lthibault commented
At present, yamux.Config.Logger
is a pointer to a concrete struct. This makes it impossible to use popular libraries such as https://github.com/sirupsen/logrus.
Fortunately, most logging libraries implicitly satisfy the following interface:
type Logger interface {
Fatal(v ...interface{})
Fatalf(format string, v ...interface{})
Fatalln(v ...interface{})
Panic(v ...interface{})
Panicf(format string, v ...interface{})
Panicln(v ...interface{})
Prefix() string
Print(v ...interface{})
Printf(format string, v ...interface{})
Println(v ...interface{})
}
Config
should take an interface like the one above in lieu of *log.Logger
.
nnam commented
+1 yamux.Config.LogOutput takes an io.Writer and can be used as a workaround, but it seems to make more sense to have yamug.Config.Logger take an interface.
gonejack commented
Agree, but this is incompatible update.