Skip to content

Make logging more flexible #179

@xaprb

Description

@xaprb

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions