mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-20 23:07:23 +08:00
add logging
This commit is contained in:
@@ -114,6 +114,7 @@ func GetEntry(ctx context.Context, filerClient FilerClient, fullFilePath string)
|
||||
|
||||
if resp.Entry != nil {
|
||||
entry = resp.Entry
|
||||
glog.V(3).Infof("read %s entry: %v", fullFilePath, entry)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@@ -10,16 +10,18 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/webdav"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/operation"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"golang.org/x/net/webdav"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/security"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
type WebDavOption struct {
|
||||
@@ -163,7 +165,7 @@ func (fs *WebDavFileSystem) Mkdir(ctx context.Context, fullDirPath string, perm
|
||||
|
||||
func (fs *WebDavFileSystem) OpenFile(ctx context.Context, fullFilePath string, flag int, perm os.FileMode) (webdav.File, error) {
|
||||
|
||||
glog.V(2).Infof("WebDavFileSystem.OpenFile %v", fullFilePath)
|
||||
glog.V(2).Infof("WebDavFileSystem.OpenFile %v %x", fullFilePath, flag)
|
||||
|
||||
var err error
|
||||
if fullFilePath, err = clearName(fullFilePath); err != nil {
|
||||
@@ -175,12 +177,6 @@ func (fs *WebDavFileSystem) OpenFile(ctx context.Context, fullFilePath string, f
|
||||
if strings.HasSuffix(fullFilePath, "/") {
|
||||
return nil, os.ErrInvalid
|
||||
}
|
||||
// based directory should be exists.
|
||||
dir, _ := path.Split(fullFilePath)
|
||||
_, err := fs.stat(ctx, dir)
|
||||
if err != nil {
|
||||
return nil, os.ErrInvalid
|
||||
}
|
||||
_, err = fs.stat(ctx, fullFilePath)
|
||||
if err == nil {
|
||||
if flag&os.O_EXCL != 0 {
|
||||
@@ -449,8 +445,10 @@ func (f *WebDavFile) Write(buf []byte) (int, error) {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
glog.V(3).Infof("WebDavFileSystem.Write %v: written [%d,%d)", f.name, f.off, f.off+int64(len(buf)))
|
||||
f.off += int64(len(buf))
|
||||
}
|
||||
|
||||
return len(buf), err
|
||||
}
|
||||
|
||||
@@ -494,10 +492,13 @@ func (f *WebDavFile) Read(p []byte) (readSize int, err error) {
|
||||
}
|
||||
readSize = int(totalRead)
|
||||
|
||||
glog.V(3).Infof("WebDavFileSystem.Read %v: [%d,%d)", f.name, f.off, f.off+totalRead)
|
||||
|
||||
f.off += totalRead
|
||||
if readSize == 0 {
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user