Skip to content

Commit

Permalink
chore: add log
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-ding committed Jan 31, 2025
1 parent 27515d1 commit 8b6558b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/storage/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (b *Base) Upload(destDir string, tryLink, detectMime, changeMediaHash bool,
}
log.Debugf("local storage target base dir is: %v", targetBase)

err = walkFn(func(path string, info fs.FileInfo) error {
err = walkFn(func(path string, info fs.FileInfo) (err error) {
if err != nil {
return err
}
Expand All @@ -113,6 +113,13 @@ func (b *Base) Upload(destDir string, tryLink, detectMime, changeMediaHash bool,
log.Debugf("file is not needed, skip: %s", info.Name())
return nil
}

defer func () {
if err == nil {
log.Infof("copy file success, filename %s, destination %s", rel, destName)
}
}()

if tryLink {
if err := os.Link(path, destName); err == nil {
return nil //link success
Expand Down

0 comments on commit 8b6558b

Please sign in to comment.