Skip to content

gmaliar/logr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logr

Logr is a simple helper for Logrus which helps wrap loggers to log Opentracing information.

Example

If you have a context that might already be in a trace, then you can simple create a new Logrus logger with your context. This a gRPC handler for example.

func (s *routeGuideServer) GetFeature(ctx context.Context, point *pb.Point) (*pb.Feature, error) {
        logr.WithCtx(ctx).Info("Called GetFeature woo!")
}

Interface

Logr follows the logr.FieldLogger interface

type FieldLogger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Printf(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})

	Debug(args ...interface{})
	Info(args ...interface{})
	Print(args ...interface{})
	Warn(args ...interface{})
	Warning(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Panic(args ...interface{})
}

About

Adds Opentracing (Zipkin) to Logrus loggers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%