zipkin-go icon indicating copy to clipboard operation
zipkin-go copied to clipboard

Add structured Logger interface

Open basvanbeek opened this issue 7 years ago • 4 comments
trafficstars

We should provide a standard structured logger interface which consumers can inject with an implementation. zipkin-go-opentracing uses an interface compatible with the Go kit logger interface which seems the best candidate.

type Logger interface {
	Log(keyvals ...interface{}) error
}

This will allow people to easily fetch the K/V pairs coming from errors and exceptions within the library and merge them with their application logging infrastructure.

For people not liking structured logging we should provide an adapter for the standard Go log.

basvanbeek avatar Dec 22 '17 17:12 basvanbeek

Ahh so this is so that the logging internal to the library is abstracted, right? Ex this is only used by tracing code.

codefromthecrypt avatar Dec 23 '17 02:12 codefromthecrypt

Yes that is correct. It allows the user of the library decide how to have errors be reported.

basvanbeek avatar Dec 23 '17 08:12 basvanbeek

I took a pass at implementing a more complete version of this to use interfaces throughout the package: https://github.com/openzipkin/zipkin-go/pull/188

kujenga avatar Mar 05 '21 21:03 kujenga

I would appreciate this feature as well. I would like to integrate zap logger using an interface.

basovnik avatar Mar 18 '22 13:03 basovnik