Documentation
¶
Overview ¶
Package rpclog provides logging support for Connect RPCs, including both unary and streaming RPCs. It implements connect.Interceptor to log RPC details such as service, method, duration, peer information, and error codes. The package supports structured logging using slog.Logger.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Interceptor ¶
type Interceptor struct {
// contains filtered or unexported fields
}
Interceptor implements the connect.Interceptor interface to provide logging support for RPCs.
func New ¶
func New(log *slog.Logger) *Interceptor
New creates and returns a new Connect RPC logger instance with the provided slog.Logger. The logger will be used as the base for all RPC logging.
func (*Interceptor) WrapStreamingClient ¶
func (l *Interceptor) WrapStreamingClient( next connect.StreamingClientFunc, ) connect.StreamingClientFunc
WrapStreamingClient implements the connect.Interceptor interface for client-side streaming RPCs. It wraps the next handler to log: - Start and end of the client stream - Duration of the stream - Service and method names
func (*Interceptor) WrapStreamingHandler ¶
func (l *Interceptor) WrapStreamingHandler( next connect.StreamingHandlerFunc, ) connect.StreamingHandlerFunc
WrapStreamingHandler implements the connect.Interceptor interface for server-side streaming RPCs. It wraps the next handler to log: - Start and end of the stream - Duration of the stream - Service and method names - Peer information - Error information (if any)
func (*Interceptor) WrapUnary ¶
func (l *Interceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc
WrapUnary implements the connect.Interceptor interface for unary RPCs. It wraps the next handler to log: - Start and end of the RPC call - Duration of the call - Service and method names - Peer information (protocol and address) - Authentication details (if available) - Error information (if any)