Documentation ¶
Index ¶
- func DefaultServerCodeToLevel(code codes.Code) zerolog.Level
- func SetLoggableEvents(events []LoggableEvent)
- func SetLogger(l zerolog.Logger)
- func UnaryClientInterceptor(timeout time.Duration) grpc.UnaryClientInterceptor
- func UnaryClientLoggingInterceptor(opts ...ClientLoggingOption) grpc.UnaryClientInterceptor
- func UnaryServerErrorHandleInterceptor() grpc.UnaryServerInterceptor
- func UnaryServerLoggerInterceptor(baseLogger zerolog.Logger) grpc.UnaryServerInterceptor
- func UnaryServerLoggingInterceptor(opts ...ServerLoggingOption) grpc.UnaryServerInterceptor
- func UnaryServerRecoveryInterceptor() grpc.UnaryServerInterceptor
- type ClientLoggingOption
- type LoggableEvent
- type ServerLoggingOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultServerCodeToLevel ¶
DefaultServerCodeToLevel is the helper mapper that maps gRPC return codes to log levels for server side.
func SetLoggableEvents ¶
func SetLoggableEvents(events []LoggableEvent)
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