uber-go / zap

Blazing fast, structured, leveled logging in Go.
https://pkg.go.dev/go.uber.org/zap
MIT License
21.87k stars 1.43k forks source link

zapgrpc implements Experimental grpclog.DepthLoggerV2 #1267

Open forsaken628 opened 1 year ago

forsaken628 commented 1 year ago

Is your feature request related to a problem? Please describe.

grpc log caller incorrect

Describe the solution you'd like A clear and concise description of what you want to happen.

zapgrpc implements Experimental grpclog.DepthLoggerV2

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Is this a breaking change? We do not accept breaking changes to the existing API. Please consider if your proposed solution is backwards compatible. If not, we can help you make it backwards compatible, but this must be considered when we consider new features.

no

Additional context Add any other context or screenshots about the feature request here.

github.com/grpc-ecosystem/go-grpc-middleware/logging/zap.zapGrpcLoggerV2 has been removed in go-grpc-middleware/v2 version

yurishkuro commented 4 months ago

possible workaround:

    grpclog.SetLoggerV2(zapgrpc.NewLogger(
        logger.WithOptions(
            zap.AddCallerSkip(5), // ensure the actual caller:lineNo is shown
        )))