From 161a7f7cb38190bd34757e74ffc22ac0e068fa5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 22 Sep 2022 12:37:16 +0200 Subject: [PATCH] Less dramatic logging when Blender cannot be found Avoid the word "error" in logging when Blender cannot be found. Typically these are warnings, and having the word "error" there makes people think otherwise. --- cmd/flamenco-worker/find_exes.go | 3 ++- internal/find_blender/find_blender.go | 2 +- internal/manager/api_impl/meta.go | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/flamenco-worker/find_exes.go b/cmd/flamenco-worker/find_exes.go index 8180a927..ff090b88 100644 --- a/cmd/flamenco-worker/find_exes.go +++ b/cmd/flamenco-worker/find_exes.go @@ -4,6 +4,7 @@ import ( "context" "errors" "io/fs" + "os/exec" "time" "github.com/rs/zerolog/log" @@ -35,7 +36,7 @@ func findBlender() { case errors.Is(err, fs.ErrNotExist): log.Warn().Msg("Blender could not be found, Flamenco Manager will have to supply a full path") case err != nil: - log.Warn().Err(err).Msg("there was an unexpected error finding Blender on this system, Flamenco Manager will have to supply a full path") + log.Warn().AnErr("cause", err).Msg("there was an issue finding Blender on this system, Flamenco Manager will have to supply a full path") default: log.Info(). Str("path", result.FoundLocation). diff --git a/internal/find_blender/find_blender.go b/internal/find_blender/find_blender.go index fd0befc6..6b36c6d6 100644 --- a/internal/find_blender/find_blender.go +++ b/internal/find_blender/find_blender.go @@ -60,7 +60,7 @@ func CheckBlender(ctx context.Context, exename string) (CheckBlenderResult, erro return CheckBlender(ctx, "blender") case err != nil: // Some other error occurred, better to report it. - return CheckBlenderResult{}, fmt.Errorf("error finding .blend file association: %w", err) + return CheckBlenderResult{}, fmt.Errorf("finding .blend file association: %w", err) default: // The full path was found, report the Blender version. return getResultWithVersion(ctx, exename, fullPath, api.BlenderPathSourceFileAssociation) diff --git a/internal/manager/api_impl/meta.go b/internal/manager/api_impl/meta.go index 6cf08b20..1e49357b 100644 --- a/internal/manager/api_impl/meta.go +++ b/internal/manager/api_impl/meta.go @@ -184,8 +184,8 @@ func (f *Flamenco) FindBlenderExePath(e echo.Context) error { case errors.Is(err, fs.ErrNotExist): logger.Info().Msg("Blender could not be found") case err != nil: - logger.Warn().Err(err).Msg("there was an error finding Blender") - return sendAPIError(e, http.StatusInternalServerError, "there was an error finding Blender: %v", err) + logger.Warn().AnErr("cause", err).Msg("there was an issue finding Blender") + return sendAPIError(e, http.StatusInternalServerError, "there was an issue finding Blender: %v", err) default: response = append(response, api.BlenderPathCheckResult{ IsUsable: true, @@ -203,7 +203,7 @@ func (f *Flamenco) FindBlenderExePath(e echo.Context) error { case errors.Is(err, fs.ErrNotExist), errors.Is(err, exec.ErrNotFound): logger.Debug().Msg("Blender could not be found as 'blender' on $PATH") case err != nil: - logger.Info().Err(err).Msg("there was an error finding Blender as 'blender' on $PATH") + logger.Info().AnErr("cause", err).Msg("there was an issue finding Blender as 'blender' on $PATH") default: response = append(response, api.BlenderPathCheckResult{ IsUsable: true,