From 1e794136c80b3d640855c7c8f930997b8dcd51e4 Mon Sep 17 00:00:00 2001 From: Matthew Straughn Date: Mon, 19 Feb 2024 21:29:26 -0500 Subject: [PATCH] MM 19654 s3 debugging logs overlap, Wrapped mlog in an io.Writer func (#25788) * updated go mod and sum files * Revert "updated go mod and sum files" This reverts commit 088dd00a848c2c31952c29f0a2a28a9fb47fc3f7. * wrapped mlog in and io.Writer func to pass to TraceOn * fixed var and func receiver names * removed the underscore in the func receiver. * passed a pointer of s3Trace to TraceOn --------- Co-authored-by: Mattermost Build --- server/platform/shared/filestore/s3store.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/platform/shared/filestore/s3store.go b/server/platform/shared/filestore/s3store.go index bae0281fdd0..1d83a9dd133 100644 --- a/server/platform/shared/filestore/s3store.go +++ b/server/platform/shared/filestore/s3store.go @@ -124,6 +124,14 @@ func newS3FileBackend(settings FileBackendSettings, isCloud bool) (*S3FileBacken return backend, nil } +type s3Trace struct { +} + +func (*s3Trace) Write(in []byte) (int, error) { + mlog.Debug(string(in)) + return len(in), nil +} + // Similar to s3.New() but allows initialization of signature v2 or signature v4 client. // If signV2 input is false, function always returns signature v4. // @@ -178,7 +186,7 @@ func (b *S3FileBackend) s3New(isCloud bool) (*s3.Client, error) { } if b.trace { - s3Clnt.TraceOn(os.Stdout) + s3Clnt.TraceOn(&s3Trace{}) } return s3Clnt, nil