mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-26 20:47:57 +08:00
add log
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"polaris/log"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
@@ -17,7 +18,7 @@ type Storage interface {
|
|||||||
|
|
||||||
func NewLocalStorage(dir string) (*LocalStorage, error) {
|
func NewLocalStorage(dir string) (*LocalStorage, error) {
|
||||||
os.MkdirAll(dir, 0655)
|
os.MkdirAll(dir, 0655)
|
||||||
|
|
||||||
return &LocalStorage{dir: dir}, nil
|
return &LocalStorage{dir: dir}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ func (l *LocalStorage) Move(src, dest string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
rel, err := filepath.Rel(src, path)
|
rel, err := filepath.Rel(src, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "relation between %s and %s", src, path)
|
return errors.Wrapf(err, "relation between %s and %s", src, path)
|
||||||
}
|
}
|
||||||
@@ -56,6 +57,7 @@ func (l *LocalStorage) Move(src, dest string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.Infof("file copy complete: %v", destName)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -65,7 +67,6 @@ func (l *LocalStorage) Move(src, dest string) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (l *LocalStorage) ReadDir(dir string) ([]fs.FileInfo, error) {
|
func (l *LocalStorage) ReadDir(dir string) ([]fs.FileInfo, error) {
|
||||||
return ioutil.ReadDir(filepath.Join(l.dir, dir))
|
return ioutil.ReadDir(filepath.Join(l.dir, dir))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user