Documentation ¶
Overview ¶
Package pplogrus instruments the sirupsen/logrus package (https://github.com/sirupsen/logrus).
This package allows additional transaction id and span id of the pinpoint span to be printed in the log message. Use the NewField or NewEntry and pass the logrus field back to the logger.
tracer := pinpoint.FromContext(ctx) logger.WithFields(pplogrus.NewField(tracer)).Fatal("oh, what a wonderful world")
or
entry := pplogrus.NewEntry(tracer).WithField("foo", "bar") entry.Error("entry log message")
You can use NewHook as the logrus.Hook. It is necessary to pass the context containing the pinpoint.Tracer to logrus.Logger.
logger.AddHook(pplogrus.NewHook()) entry := logger.WithContext(pinpoint.NewContext(context.Background(), tracer)).WithField("foo", "bar") entry.Error("hook log message")
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEntry ¶
NewEntry returns a new *logrus.Entry from standard logger. The entry has the transaction id and the span id of a pinpoint span.
func NewField ¶
NewField returns a new logrus.Fields added the transaction id and the span id of a pinpoint span.
func NewLoggerEntry ¶
NewLoggerEntry returns a new *logrus.Entry from the provided logger. The entry has the transaction id and the span id of a pinpoint span.
Types ¶
This section is empty.