Skip to content

Instantly share code, notes, and snippets.

@tedsuo
Last active August 18, 2016 18:02
Show Gist options
  • Select an option

  • Save tedsuo/bc9e4bacd0f6d0ce70b9a4af24e3b71f to your computer and use it in GitHub Desktop.

Select an option

Save tedsuo/bc9e4bacd0f6d0ce70b9a4af24e3b71f to your computer and use it in GitHub Desktop.
Adding OpenTracing to Lager
func FromContext(context.Context) Logger {}
func FromSpan(opentracing.Span) Logger {}
func FromHTTPHeaders(http.Header) Logger {}
func ToHTTPHeaders(Logger, http.Header) {}
type Logger interface {
// Lifecycle
Start(name string, data ...Data) Logger
Succeed(data ...Data)
Fail(error,data ...Data)
// Log Levels
Debug(action string, data ...Data)
Info(action string, data ...Data)
Error(action string, err error, data ...Data)
Fatal(action string, err error, data ...Data)
// WithData returns a logger which adds Data to be serialized
// on all subsequent local logs
WithData(Data) Logger
// WithBaggage returns a logger which adds Data to be serialized
// on all subsequent rpc calls. Very expensive.
WithBaggage(Data) Logger
// Span enables opentracing compliance
Span() opentracing.Span
// Context creates a new Context if one has not been set
Context() context.Context
WithContext(context.Context) Logger
// Loggers can print their current operation name
String() string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment