interceptor

package
v0.0.0-...-848a935 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultServerCodeToLevel

func DefaultServerCodeToLevel(code codes.Code) zerolog.Level

DefaultServerCodeToLevel is the helper mapper that maps gRPC return codes to log levels for server side.

func SetLoggableEvents

func SetLoggableEvents(events []LoggableEvent)

func SetLogger

func SetLogger(l zerolog.Logger)

func UnaryClientInterceptor

func UnaryClientInterceptor(timeout time.Duration) grpc.UnaryClientInterceptor

UnaryClientInterceptor returns a new unary client interceptor that sets a timeout on the request context.

func UnaryClientLoggingInterceptor

func UnaryClientLoggingInterceptor(opts ...ClientLoggingOption) grpc.UnaryClientInterceptor

UnaryClientLoggingInterceptor logging grpc invoke grpc log

func UnaryServerErrorHandleInterceptor

func UnaryServerErrorHandleInterceptor() grpc.UnaryServerInterceptor

UnaryServerErrorHandleInterceptor is logging error

func UnaryServerLoggerInterceptor

func UnaryServerLoggerInterceptor(baseLogger zerolog.Logger) grpc.UnaryServerInterceptor

UnaryServerLoggerInterceptor is spawn MyLogger to each request context

func UnaryServerLoggingInterceptor

func UnaryServerLoggingInterceptor(opts ...ServerLoggingOption) grpc.UnaryServerInterceptor

UnaryServerLoggingInterceptor logging grpc access log and reply status

func UnaryServerRecoveryInterceptor

func UnaryServerRecoveryInterceptor() grpc.UnaryServerInterceptor

UnaryServerRecoveryInterceptor returns a new unary server recovery for panic recovery.

Types

type ClientLoggingOption

type ClientLoggingOption interface {
	// contains filtered or unexported methods
}

ClientLoggingOption grpc client logging

func WithClientDump

func WithClientDump(dump bool) ClientLoggingOption

WithClientDump grpc logging for enable dump req/reply log useful to help debug

type LoggableEvent

type LoggableEvent uint
const (
	// AccessLog is a loggable event representing start of the gRPC call.
	AccessLog LoggableEvent = iota
	RequestDump
	ResponseDump
)

type ServerLoggingOption

type ServerLoggingOption interface {
	// contains filtered or unexported methods
}

func WithLoggableEvents

func WithLoggableEvents(loggableEvents ...LoggableEvent) ServerLoggingOption

func WithSkipper

func WithSkipper(skips ...func(req any, info *grpc.UnaryServerInfo) bool) ServerLoggingOption

WithSkipper grpc logging for skip some logs

Jump to

Keyboard shortcuts

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