middleware

package
v0.0.0-...-5f57c41 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RealIPHeader = "x-real-ip"
View Source
var RequestIDHeader = "x-request-id"

Functions

func GetRealIP

func GetRealIP(ctx context.Context) string

func GetReqID

func GetReqID(ctx context.Context) string

func LoggerMiddleware

func LoggerMiddleware() grpc.UnaryServerInterceptor

func RealIPMiddleware

func RealIPMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error)

func RecoveryMiddleware

func RecoveryMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error)

func RequestIDMiddleware

func RequestIDMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error)

func WithReqID

func WithReqID(ctx context.Context, reqID string) context.Context

Types

type LoggerV2

type LoggerV2 struct {
	// contains filtered or unexported fields
}

func NewLoggerV2

func NewLoggerV2(logger *log.ServiceLogger) *LoggerV2

func (*LoggerV2) Error

func (l *LoggerV2) Error(args ...interface{})

Error logs to ERROR log. Arguments are handled in the manner of fmt.Print.

func (*LoggerV2) Errorf

func (l *LoggerV2) Errorf(format string, args ...interface{})

Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf.

func (*LoggerV2) Errorln

func (l *LoggerV2) Errorln(args ...interface{})

Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println.

func (*LoggerV2) Fatal

func (l *LoggerV2) Fatal(args ...interface{})

Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print. gRPC ensures that all Fatal logs will exit with os.Exit(1). Implementations may also call os.Exit() with a non-zero exit code.

func (*LoggerV2) Fatalf

func (l *LoggerV2) Fatalf(format string, args ...interface{})

Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. gRPC ensures that all Fatal logs will exit with os.Exit(1). Implementations may also call os.Exit() with a non-zero exit code.

func (*LoggerV2) Fatalln

func (l *LoggerV2) Fatalln(args ...interface{})

Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println. gRPC ensures that all Fatal logs will exit with os.Exit(1). Implementations may also call os.Exit() with a non-zero exit code.

func (*LoggerV2) Info

func (l *LoggerV2) Info(args ...interface{})

Info logs to INFO log. Arguments are handled in the manner of fmt.Print.

func (*LoggerV2) Infof

func (l *LoggerV2) Infof(format string, args ...interface{})

Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf.

func (*LoggerV2) Infoln

func (l *LoggerV2) Infoln(args ...interface{})

Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println.

func (*LoggerV2) V

func (l *LoggerV2) V(level int) bool

V reports whether verbosity level l is at least the requested verbose level.

func (*LoggerV2) Warning

func (l *LoggerV2) Warning(args ...interface{})

Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print.

func (*LoggerV2) Warningf

func (l *LoggerV2) Warningf(format string, args ...interface{})

Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf.

func (*LoggerV2) Warningln

func (l *LoggerV2) Warningln(args ...interface{})

Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println.

Jump to

Keyboard shortcuts

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