Documentation
¶
Index ¶
- func FilterLogs(req any) map[string]interface{}
- func GetLogger(ctx context.Context) log.FieldLogger
- func UnaryServerInterceptor(logger log.FieldLogger, extractFunction ExtractFunction) grpc.UnaryServerInterceptor
- func WithLogger(ctx context.Context, logger log.FieldLogger) context.Context
- type ExtractFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterLogs ¶
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(logger log.FieldLogger, extractFunction ExtractFunction) grpc.UnaryServerInterceptor
The first registerred interceptor will be called first. Need to register requestid first to add request-id. Then the logger can get the request-id.
func WithLogger ¶
Types ¶
type ExtractFunction ¶
type ExtractFunction func(ctx context.Context, req any, info *grpc.UnaryServerInfo, logger log.FieldLogger) log.FieldLogger
ExtractFunction extracts information from the ctx and/or the request and put it in the logger. This function is called before the application's handler is called so that it can add more context to the logger.
Click to show internal directories.
Click to hide internal directories.