diff options
author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-06-24 00:06:47 +0200 |
---|---|---|
committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-06-24 00:06:47 +0200 |
commit | 5bb3d3ecabfc658035e69d5d5286cabaf44e3f73 (patch) | |
tree | ed13377099c8b451acc5553e370e54cfee2a44ef /pkg | |
parent | 1d6fa60b3c60d068d12b19f10f5ad73e836b5a70 (diff) | |
download | lens-5bb3d3ecabfc658035e69d5d5286cabaf44e3f73.tar.gz lens-5bb3d3ecabfc658035e69d5d5286cabaf44e3f73.tar.bz2 lens-5bb3d3ecabfc658035e69d5d5286cabaf44e3f73.zip |
feat: Add log to list list processor
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/worker/list_processor.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/worker/list_processor.go b/pkg/worker/list_processor.go index 8169e4e..c9c20a9 100644 --- a/pkg/worker/list_processor.go +++ b/pkg/worker/list_processor.go @@ -4,6 +4,8 @@ import ( "context" "errors" "sync" + + "github.com/sirupsen/logrus" ) type ( @@ -26,6 +28,7 @@ type ( listProcessorWorker[T any] struct { listProcessor ListProcessor[T] + logrus *logrus.Entry scheduler *Scheduler } ) @@ -33,10 +36,12 @@ type ( func NewWorkerFromListProcessor[T any]( listProcessor ListProcessor[T], scheduler *Scheduler, + logrus *logrus.Entry, ) Worker { return &listProcessorWorker[T]{ listProcessor: listProcessor, scheduler: scheduler, + logrus: logrus, } } @@ -75,7 +80,7 @@ func (l *listProcessorWorker[T]) Start(ctx context.Context) error { defer l.scheduler.Return() defer wg.Done() if err := l.listProcessor.Process(ctx, v); err != nil && !errors.Is(err, context.Canceled) { - println("Err", err.Error()) + l.logrus.WithError(err).Error("Error processing batch") } }(v) } |