MCPcopy
hub / github.com/redis/go-redis / PostHook

Method PostHook

maintnotifications/hooks.go:44–54  ·  view source on GitHub ↗

PostHook logs the result after processing.

(ctx context.Context, notificationCtx push.NotificationHandlerContext, notificationType string, notification []interface{}, result error)

Source from the content-addressed store, hash-verified

42
43// PostHook logs the result after processing.
44func (lh *LoggingHook) PostHook(ctx context.Context, notificationCtx push.NotificationHandlerContext, notificationType string, notification []interface{}, result error) {
45 connID := uint64(0)
46 if conn, ok := notificationCtx.Conn.(*pool.Conn); ok {
47 connID = conn.GetID()
48 }
49 if result != nil && lh.LogLevel >= 1 { // Warning level
50 internal.Logger.Printf(ctx, logs.ProcessingNotificationFailed(connID, notificationType, result, notification))
51 } else if lh.LogLevel >= 3 { // Debug level
52 internal.Logger.Printf(ctx, logs.ProcessingNotificationSucceeded(connID, notificationType))
53 }
54}
55
56// NewLoggingHook creates a new logging hook with the specified log level.
57// Log levels: 0=Error, 1=Warn, 2=Info, 3=Debug

Callers

nothing calls this directly

Calls 4

GetIDMethod · 0.80
PrintfMethod · 0.65

Tested by

no test coverage detected