Skip to content

Commit d77d5d0

Browse files
committed
localfs: added logging
1 parent 1ebfbef commit d77d5d0

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

internal/http/services/owncloud/ocdav/propfind.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func (s *svc) getResourceInfos(ctx context.Context, w http.ResponseWriter, r *ht
263263

264264
res, err := client.Stat(ctx, req)
265265
if err != nil {
266-
log.Error().Err(err).Interface("req", req).Msg("error sending a grpc stat request")
266+
log.Error().Err(err).Interface("req", req).Msg("error sending a stat request to the gateway")
267267
w.WriteHeader(http.StatusInternalServerError)
268268
return nil, nil, false
269269
} else if res.Status.Code != rpc.Code_CODE_OK {

pkg/storage/utils/localfs/localfs.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,7 @@ func (fs *localfs) moveReferences(ctx context.Context, oldName, newName string)
912912
}
913913

914914
func (fs *localfs) GetMD(ctx context.Context, ref *provider.Reference, mdKeys []string) (*provider.ResourceInfo, error) {
915+
log := appctx.GetLogger(ctx)
915916
fn, err := fs.resolve(ctx, ref)
916917
if err != nil {
917918
return nil, errors.Wrap(err, "localfs: error resolving ref")
@@ -926,6 +927,7 @@ func (fs *localfs) GetMD(ctx context.Context, ref *provider.Reference, mdKeys []
926927
fn = fs.wrap(ctx, fn)
927928
md, err := os.Stat(fn)
928929
if err != nil {
930+
log.Warn().Str("path", fn).Any("md", md).Err(err).Msg("failed stat call in localfs")
929931
if os.IsNotExist(err) {
930932
return nil, errtypes.NotFound(fn)
931933
}
@@ -952,6 +954,7 @@ func (fs *localfs) getMDShareFolder(ctx context.Context, p string, mdKeys []stri
952954
}
953955

954956
func (fs *localfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys []string) ([]*provider.ResourceInfo, error) {
957+
log := appctx.GetLogger(ctx)
955958
fn, err := fs.resolve(ctx, ref)
956959
if err != nil {
957960
return nil, errors.Wrap(err, "localfs: error resolving ref")
@@ -960,6 +963,7 @@ func (fs *localfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKe
960963
if fn == "/" {
961964
homeFiles, err := fs.listFolder(ctx, fn, mdKeys)
962965
if err != nil {
966+
log.Warn().Err(err).Msg("failed to execute listFolder for root")
963967
return nil, err
964968
}
965969
if !fs.conf.DisableHome {
@@ -973,14 +977,22 @@ func (fs *localfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKe
973977
}
974978

975979
if fs.isShareFolderRoot(ctx, fn) {
976-
return fs.listShareFolderRoot(ctx, fn, mdKeys)
980+
res, err := fs.listShareFolderRoot(ctx, fn, mdKeys)
981+
if err != nil {
982+
log.Warn().Str("fn", fn).Err(err).Msg("failed to execute listShareFolderRoot")
983+
}
984+
return res, err
977985
}
978986

979987
if fs.isShareFolderChild(ctx, fn) {
980988
return nil, errtypes.PermissionDenied("localfs: error listing folders inside the shared folder, only file references are stored inside")
981989
}
982990

983-
return fs.listFolder(ctx, fn, mdKeys)
991+
res, err := fs.listFolder(ctx, fn, mdKeys)
992+
if err != nil {
993+
log.Warn().Str("fn", fn).Err(err).Msg("failed to execute listFolder")
994+
}
995+
return res, err
984996
}
985997

986998
func (fs *localfs) listFolder(ctx context.Context, fn string, mdKeys []string) ([]*provider.ResourceInfo, error) {

0 commit comments

Comments
 (0)