middleware

package
v0.0.0-...-0d40728 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2021 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateStreamClientInterceptor

func GenerateStreamClientInterceptor(trace bool) grpc.StreamClientInterceptor

GenerateStreamClientInterceptor creates an interceptor function that will log grpc streaming calls.

func GenerateUnaryClientInterceptor

func GenerateUnaryClientInterceptor(trace bool) grpc.UnaryClientInterceptor

GenerateUnaryClientInterceptor creates an interceptor function that will log unary grpc calls.

func Gzip

func Gzip(h http.Handler) http.Handler

Gzip represents a middleware handler to support gzip compression.

func Log

func Log(h http.Handler) http.Handler

Log is a middleware that logs each request. Inspired from the logging middleware from zenazn/goji: https://github.com/zenazn/goji/blob/master/web/middleware/logger.go

Types

type LoggingClient

type LoggingClient struct {
	http.Client
}

LoggingClient is an http.Client that logs *outoing* REST requests.

func (*LoggingClient) Do

func (c *LoggingClient) Do(req *http.Request) (*http.Response, error)

Do wraps the basic http.Client.Do call to log requests and responses.

type LoggingClientStream

type LoggingClientStream struct {
	grpc.ClientStream
	// contains filtered or unexported fields
}

LoggingClientStream implements a GRPC client stream that logs output

func (*LoggingClientStream) RecvMsg

func (c *LoggingClientStream) RecvMsg(m interface{}) error

RecvMsg logs messages recieved over a GRPC stream

func (*LoggingClientStream) SendMsg

func (c *LoggingClientStream) SendMsg(m interface{}) error

SendMsg logs messages sent out over a GRPC stream

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL