Documentation
¶
Overview ¶
Package log contains interceptor/middleware helpers for logging.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCodeToLevel ¶
DefaultCodeToLevel is the default implementation of gRPC return codes to log levels for server side.
Types ¶
type Config ¶
type Config struct { // LogStreamRecvMsg if true, log out the contents of each received stream // message. LogStreamRecvMsg bool // LogStreamSendMsg if true, log out the contents of each sent stream // message. LogStreamSendMsg bool // LogUnaryReqMsg if true, log out the contents of the request // message/argument/parameters. LogUnaryReqMsg bool // LogAuthHeader if true, log out the contents of the authorization request // header. LogAuthHeader bool // LogCookies if true, log out the contents of any cookie header. LogCookies bool // IgnoreHeaders contains a list of request headers to filter from output. IgnoreHeaders []string // Default fields that should be included with all log messages. These can // be overwritten in your application. DefaultFields map[string]interface{} }
Config contains the log interceptor configuration.
type CtxKey ¶
type CtxKey struct{}
CtxKey is the key to use to lookup the log field map in the context.
type Interceptor ¶
type Interceptor struct {
// contains filtered or unexported fields
}
Interceptor implements gRPC interceptor middleware methods that logs the request as it comes in and the response as it goes out.
func (*Interceptor) StreamInterceptor ¶
func (intr *Interceptor) StreamInterceptor( srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler, ) error
StreamInterceptor is a grpc interceptor middleware that logs out the requests as they come in and the responses as they go out.
func (*Interceptor) UnaryInterceptor ¶
func (intr *Interceptor) UnaryInterceptor( ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (interface{}, error)
UnaryInterceptor is a grpc interceptor middleware that logs out the request as it comes in, and the response as it goes out.