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.
This commit is contained in:
Sybren A. Stüvel 2022-09-22 12:37:16 +02:00
parent cb2042db71
commit 161a7f7cb3
3 changed files with 6 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"errors" "errors"
"io/fs" "io/fs"
"os/exec"
"time" "time"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
@ -35,7 +36,7 @@ func findBlender() {
case errors.Is(err, fs.ErrNotExist): case errors.Is(err, fs.ErrNotExist):
log.Warn().Msg("Blender could not be found, Flamenco Manager will have to supply a full path") log.Warn().Msg("Blender could not be found, Flamenco Manager will have to supply a full path")
case err != nil: 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: default:
log.Info(). log.Info().
Str("path", result.FoundLocation). Str("path", result.FoundLocation).

View File

@ -60,7 +60,7 @@ func CheckBlender(ctx context.Context, exename string) (CheckBlenderResult, erro
return CheckBlender(ctx, "blender") return CheckBlender(ctx, "blender")
case err != nil: case err != nil:
// Some other error occurred, better to report it. // 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: default:
// The full path was found, report the Blender version. // The full path was found, report the Blender version.
return getResultWithVersion(ctx, exename, fullPath, api.BlenderPathSourceFileAssociation) return getResultWithVersion(ctx, exename, fullPath, api.BlenderPathSourceFileAssociation)

View File

@ -184,8 +184,8 @@ func (f *Flamenco) FindBlenderExePath(e echo.Context) error {
case errors.Is(err, fs.ErrNotExist): case errors.Is(err, fs.ErrNotExist):
logger.Info().Msg("Blender could not be found") logger.Info().Msg("Blender could not be found")
case err != nil: case err != nil:
logger.Warn().Err(err).Msg("there was an error finding Blender") logger.Warn().AnErr("cause", err).Msg("there was an issue finding Blender")
return sendAPIError(e, http.StatusInternalServerError, "there was an error finding Blender: %v", err) return sendAPIError(e, http.StatusInternalServerError, "there was an issue finding Blender: %v", err)
default: default:
response = append(response, api.BlenderPathCheckResult{ response = append(response, api.BlenderPathCheckResult{
IsUsable: true, 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): case errors.Is(err, fs.ErrNotExist), errors.Is(err, exec.ErrNotFound):
logger.Debug().Msg("Blender could not be found as 'blender' on $PATH") logger.Debug().Msg("Blender could not be found as 'blender' on $PATH")
case err != nil: 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: default:
response = append(response, api.BlenderPathCheckResult{ response = append(response, api.BlenderPathCheckResult{
IsUsable: true, IsUsable: true,