-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
I notice that there is a non-public log variable declared in util.go, and it is used in a couple of places. I'd like to suggest giving users more control over this. I would suggest defining an interface that can be satisfied by a log.Logger
but with the minimum needed properties, such as
type Logger interface {
Println(v ...interface{})
}
Then that log variable could be defined as type Logger
and you could assign a log.Logger
to it. This could be user-settable via a publicly visible function (guarded with locks).
We have such an interface defined internally in our non-open-source code and we use it to allow uses such as this without creating explicit dependencies on a type. It also allows us to specify a reduced set of operations that we want to be taken on our log types. This is helpful because of some of the reasons outlined in http://www.jerf.org/iri/post/2923 for example.