From 76d8a75184aa1b3b8ba4002cd99b05c86e9cfb3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Wed, 24 Nov 2021 12:12:32 +0100 Subject: [PATCH] worker: normalize job logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The format is now always 'JOB_ID' (JOB_TYPE). This means that we also know the job type when a job is finished or when it failed. Signed-off-by: Ondřej Budai --- cmd/osbuild-worker/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/osbuild-worker/main.go b/cmd/osbuild-worker/main.go index 75854a1ec..4bc776c19 100644 --- a/cmd/osbuild-worker/main.go +++ b/cmd/osbuild-worker/main.go @@ -104,7 +104,7 @@ func RequestAndRunJob(client *worker.Client, acceptedJobTypes []string, jobImpls return err } - logrus.Infof("Running '%s' job %v\n", job.Type(), job.Id()) + logrus.Infof("Running job '%s' (%s)\n", job.Id(), job.Type()) ctx, cancelWatcher := context.WithCancel(context.Background()) go WatchJob(ctx, job) @@ -112,12 +112,12 @@ func RequestAndRunJob(client *worker.Client, acceptedJobTypes []string, jobImpls err = impl.Run(job) cancelWatcher() if err != nil { - logrus.Warnf("Job %s failed: %v", job.Id(), err) + logrus.Warnf("Job '%s' (%s) failed: %v", job.Id(), job.Type(), err) // Don't return this error so the worker picks up the next job immediately return nil } - logrus.Infof("Job %s finished", job.Id()) + logrus.Infof("Job '%s' (%s) finished", job.Id(), job.Type()) return nil }