From 923ee0cf730f4bcd65ad8d755b269694e2e64b12 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 22 May 2024 18:34:50 +0200 Subject: [PATCH] Thumbs: Reduce log level for libvips warnings #1474 Signed-off-by: Michael Mayer --- internal/thumb/create_test.go | 3 +-- internal/thumb/vips_init.go | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/thumb/create_test.go b/internal/thumb/create_test.go index 42b471cae70..e6af88c3358 100644 --- a/internal/thumb/create_test.go +++ b/internal/thumb/create_test.go @@ -493,14 +493,13 @@ func TestCreate(t *testing.T) { assert.Equal(t, 750, bounds.Max.X) assert.Equal(t, 500, bounds.Max.Y) - resized, err := Create(img, dst, -5, tile500.Height, tile500.Options...) + _, err = Create(img, dst, -5, tile500.Height, tile500.Options...) if err == nil { t.Fatal("error expected") } assert.Equal(t, "thumb: width has an invalid value (-5)", err.Error()) - t.Log(resized) }) t.Run("invalid height", func(t *testing.T) { tile500 := Sizes[Tile500] diff --git a/internal/thumb/vips_init.go b/internal/thumb/vips_init.go index d0aa6ec5b73..066bddd1850 100644 --- a/internal/thumb/vips_init.go +++ b/internal/thumb/vips_init.go @@ -42,7 +42,7 @@ func vipsInit() { case vips.LogLevelError, vips.LogLevelCritical: log.Errorf("%s: %s", strings.TrimSpace(strings.ToLower(domain)), msg) case vips.LogLevelWarning: - log.Warnf("%s: %s", strings.TrimSpace(strings.ToLower(domain)), msg) + log.Debugf("%s: %s", strings.TrimSpace(strings.ToLower(domain)), msg) default: log.Tracef("%s: %s", strings.TrimSpace(strings.ToLower(domain)), msg) } @@ -68,11 +68,11 @@ func vipsConfig() *vips.Config { // vipsLogLevel provides the libvips equivalent of the current log level. func vipsLogLevel() vips.LogLevel { switch log.GetLevel() { - case logrus.PanicLevel, logrus.FatalLevel, logrus.ErrorLevel: - return vips.LogLevelError + case logrus.DebugLevel: + return vips.LogLevelWarning case logrus.TraceLevel: return vips.LogLevelDebug default: - return vips.LogLevelWarning + return vips.LogLevelError } }