make thumbnails service log less noisy
This commit is contained in:
2 files changed
+19
-3
No files matched your search
@@ -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
|
||||||
@@ -2,10 +2,12 @@ package decorators
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||||
thumbnailssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/thumbnails/v0"
|
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.
|
// NewLogging returns a service that logs messages.
|
||||||
@@ -32,9 +34,17 @@ func (l logging) GetThumbnail(ctx context.Context, req *thumbnailssvc.GetThumbna
|
|||||||
Logger()
|
Logger()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warn().
|
merror := merrors.FromError(err)
|
||||||
Err(err).
|
switch merror.Code {
|
||||||
Msg("Failed to execute")
|
case http.StatusNotFound:
|
||||||
|
logger.Debug().
|
||||||
|
Str("error_detail", merror.Detail).
|
||||||
|
Msg("no thumbnail found")
|
||||||
|
default:
|
||||||
|
logger.Warn().
|
||||||
|
Err(err).
|
||||||
|
Msg("Failed to execute")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.Debug().
|
logger.Debug().
|
||||||
Msg("")
|
Msg("")
|
||||||
|
|||||||
Reference in new issue
Block a user