Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make thumbnails service log less noisy #3959

Merged
merged 1 commit into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/thumbnails-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Make thumbnails service log less noisy

Reduced the log severity when no thumbnail was found from warn to debug.
This reduces the spam in the logs.

https://github.com/owncloud/ocis/pull/3959
16 changes: 13 additions & 3 deletions extensions/thumbnails/pkg/service/grpc/v0/decorators/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package decorators

import (
"context"
"net/http"
"time"

"github.com/owncloud/ocis/v2/ocis-pkg/log"
thumbnailssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/thumbnails/v0"
merrors "go-micro.dev/v4/errors"
)

// NewLogging returns a service that logs messages.
Expand All @@ -32,9 +34,17 @@ func (l logging) GetThumbnail(ctx context.Context, req *thumbnailssvc.GetThumbna
Logger()

if err != nil {
logger.Warn().
Err(err).
Msg("Failed to execute")
merror := merrors.FromError(err)
switch merror.Code {
case http.StatusNotFound:
logger.Debug().
Str("error_detail", merror.Detail).
Msg("no thumbnail found")
default:
logger.Warn().
Err(err).
Msg("Failed to execute")
}
} else {
logger.Debug().
Msg("")
Expand Down