grpc_requestlog

package
v0.0.0-...-22e38cd Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package grpc_requestlog is a generic server-side gRPC middleware that outputs request log. If the request ID is not specified, it will be automatically generated.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnaryServerInterceptor

func UnaryServerInterceptor(logger applog.Logger, opt ...Option) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a gRPC middleware that outputs request logs.

Types

type Option

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

Option is an option when creating middleware.

func RequestIDFunc

func RequestIDFunc(fn func() (string, error)) Option

RequestIDFunc is a function option to automatically generate a request ID when it is not specified. The default is a function that generates a UUID.

func RequestIDKey

func RequestIDKey(key string) Option

RequestIDKey is a key option for the request ID specified in the metadata. The default is "Request-ID".

Jump to

Keyboard shortcuts

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