xframe/component/queue/asynq/internal/errhandler/errhandler.go

17 lines
376 B
Go
Raw Normal View History

2024-10-12 12:55:20 +08:00
package errhandler
import (
"context"
"git.wishpal.cn/wishpal_ironfan/xframe/component/logger"
"github.com/hibiken/asynq"
)
type ErrorHandler struct {
}
func (h ErrorHandler) HandleError(ctx context.Context, task *asynq.Task, err error) {
logger.WithContext(ctx).Errorf("asynq task failed, task type: %s, payload: %s, error: %v", task.Type(),
task.Payload(), err)
}