PostHook logs the result after processing.
(ctx context.Context, notificationCtx push.NotificationHandlerContext, notificationType string, notification []interface{}, result error)
| 42 | |
| 43 | // PostHook logs the result after processing. |
| 44 | func (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 |
nothing calls this directly
no test coverage detected