func UnaryServerInterceptor()

in grpc/server/ctxlogger/ctxlogger.go [53:67]


func UnaryServerInterceptor(logger *log.Logger, extractFunction ExtractFunction) grpc.UnaryServerInterceptor {
	return func(ctx context.Context, req any, info *grpc.UnaryServerInfo,
		handler grpc.UnaryHandler) (resp any, err error) {
		l := logger
		if extractFunction != nil {
			l = extractFunction(ctx, req, info, l)
		} else {
			l = defaultExtractFunction(ctx, req, info, l)
		}
		l = l.With(requestContentLogKey, FilterLogs(req))
		ctx = WithLogger(ctx, l)
		// log.Print("logger ctx: ", ctx)
		return handler(ctx, req)
	}
}