grpc_log

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamServerInterceptor

func StreamServerInterceptor(
	logContextProvider FieldContext,
	traceContextProvider TraceContext,
	logger Logger,
	options ...Option,
) grpc.StreamServerInterceptor

func UnaryServerInterceptor

func UnaryServerInterceptor(
	logContextProvider FieldContext,
	traceContextProvider TraceContext,
	logger Logger,
	options ...Option,
) grpc.UnaryServerInterceptor

Types

type FieldContext

type FieldContext interface {
	WithAttrs(context.Context, ...slog.Attr) context.Context
}

type Logger

type Logger interface {
	Info(context.Context, string)
	Error(context.Context, string)
	Debug(context.Context, string)
}

type Option

type Option func(*options)

func WithCodes

func WithCodes(f grpc_logging.ErrorToCode) Option

WithCodes customizes the function for mapping errors to error codes.

func WithRequestBody

func WithRequestBody(f alwaysDecider) Option

WithRequestBody customizes the function for deciding if the gRPC interceptor logs the request body.

type TraceContext

type TraceContext interface {
	WithTrace(context.Context, string) context.Context
}

Jump to

Keyboard shortcuts

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