diff --git a/pkg/worker/worker.go b/pkg/worker/worker.go
index b768320465871193d203467657b48372e7d2a0ba..454716651ae13ed05db23317c496b1b87027c668 100644
--- a/pkg/worker/worker.go
+++ b/pkg/worker/worker.go
@@ -25,6 +25,10 @@ tasks []*Work
}
)
+const (
+ format = "2006.01.02 15:04:05"
+)
+
func NewTaskPool() *TaskPool {
return &TaskPool{}
}
@@ -38,12 +42,15 @@ select {
case <-ctx.Done():
return ctx.Err()
case <-timer.C:
- fmt.Println("Process starting: ", w.Name)
+ now := time.Now()
+ fmt.Printf("[%s] Process starting: %s\n", time.Now().Format(format), w.Name)
if err := w.Task.Start(ctx); err != nil && !errors.Is(err, context.Canceled) {
- fmt.Println("Process errored: ", w.Name, err.Error())
+ since := time.Since(now)
+ fmt.Printf("[%s] Process errored (%s): %s\n", time.Now().Format(format), since.String(), w.Name)
return err
} else {
- fmt.Println("Process done: ", w.Name)
+ since := time.Since(now)
+ fmt.Printf("[%s] Process done (%s): %s\n", time.Now().Format(format), since.String(), w.Name)
}
}
timer.Reset(w.wait)