Log errors with %v
This commit is contained in:
parent
46135d830e
commit
2cfb3834f2
9 changed files with 23 additions and 23 deletions
|
@ -639,12 +639,12 @@ func (o *Object) readMetaData() (err error) {
|
|||
func (o *Object) ModTime() time.Time {
|
||||
err := o.readMetaData()
|
||||
if err != nil {
|
||||
fs.Log(o, "Failed to read metadata: %s", err)
|
||||
fs.Log(o, "Failed to read metadata: %v", err)
|
||||
return time.Now()
|
||||
}
|
||||
modTime, err := time.Parse(timeFormat, *o.info.ModifiedDate)
|
||||
if err != nil {
|
||||
fs.Log(o, "Failed to read mtime from object: %s", err)
|
||||
fs.Log(o, "Failed to read mtime from object: %v", err)
|
||||
return time.Now()
|
||||
}
|
||||
return modTime
|
||||
|
|
|
@ -884,12 +884,12 @@ func (o *Object) readMetaData() (err error) {
|
|||
func (o *Object) ModTime() time.Time {
|
||||
err := o.readMetaData()
|
||||
if err != nil {
|
||||
fs.Log(o, "Failed to read metadata: %s", err)
|
||||
fs.Log(o, "Failed to read metadata: %v", err)
|
||||
return time.Now()
|
||||
}
|
||||
modTime, err := time.Parse(timeFormatIn, o.modifiedDate)
|
||||
if err != nil {
|
||||
fs.Log(o, "Failed to read mtime from object: %s", err)
|
||||
fs.Log(o, "Failed to read mtime from object: %v", err)
|
||||
return time.Now()
|
||||
}
|
||||
return modTime
|
||||
|
|
|
@ -679,7 +679,7 @@ func (o *Object) readMetaData() (err error) {
|
|||
func (o *Object) ModTime() time.Time {
|
||||
err := o.readMetaData()
|
||||
if err != nil {
|
||||
fs.Log(o, "Failed to read metadata: %s", err)
|
||||
fs.Log(o, "Failed to read metadata: %v", err)
|
||||
return time.Now()
|
||||
}
|
||||
return o.modTime
|
||||
|
|
|
@ -72,7 +72,7 @@ func CheckHashes(src, dst Object) (equal bool, hash HashType, err error) {
|
|||
srcHash, err := src.Hash(hash)
|
||||
if err != nil {
|
||||
Stats.Error()
|
||||
ErrorLog(src, "Failed to calculate src hash: %s", err)
|
||||
ErrorLog(src, "Failed to calculate src hash: %v", err)
|
||||
return false, hash, err
|
||||
}
|
||||
if srcHash == "" {
|
||||
|
@ -81,7 +81,7 @@ func CheckHashes(src, dst Object) (equal bool, hash HashType, err error) {
|
|||
dstHash, err := dst.Hash(hash)
|
||||
if err != nil {
|
||||
Stats.Error()
|
||||
ErrorLog(dst, "Failed to calculate dst hash: %s", err)
|
||||
ErrorLog(dst, "Failed to calculate dst hash: %v", err)
|
||||
return false, hash, err
|
||||
}
|
||||
if dstHash == "" {
|
||||
|
@ -156,7 +156,7 @@ func Equal(src, dst Object) bool {
|
|||
return false
|
||||
} else if err != nil {
|
||||
Stats.Error()
|
||||
ErrorLog(dst, "Failed to read set modification time: %s", err)
|
||||
ErrorLog(dst, "Failed to read set modification time: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ tryAgain:
|
|||
in0, err = src.Open()
|
||||
if err != nil {
|
||||
Stats.Error()
|
||||
ErrorLog(src, "Failed to open: %s", err)
|
||||
ErrorLog(src, "Failed to open: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ tryAgain:
|
|||
}
|
||||
if err != nil {
|
||||
Stats.Error()
|
||||
ErrorLog(src, "Failed to copy: %s", err)
|
||||
ErrorLog(src, "Failed to copy: %v", err)
|
||||
removeFailedCopy(dst)
|
||||
return
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ tryAgain:
|
|||
if !Config.IgnoreSize && src.Size() != dst.Size() {
|
||||
Stats.Error()
|
||||
err = errors.Errorf("corrupted on transfer: sizes differ %d vs %d", src.Size(), dst.Size())
|
||||
ErrorLog(dst, "%s", err)
|
||||
ErrorLog(dst, "%v", err)
|
||||
removeFailedCopy(dst)
|
||||
return
|
||||
}
|
||||
|
@ -284,16 +284,16 @@ tryAgain:
|
|||
srcSum, err := src.Hash(hashType)
|
||||
if err != nil {
|
||||
Stats.Error()
|
||||
ErrorLog(src, "Failed to read src hash: %s", err)
|
||||
ErrorLog(src, "Failed to read src hash: %v", err)
|
||||
} else if srcSum != "" {
|
||||
dstSum, err := dst.Hash(hashType)
|
||||
if err != nil {
|
||||
Stats.Error()
|
||||
ErrorLog(dst, "Failed to read hash: %s", err)
|
||||
ErrorLog(dst, "Failed to read hash: %v", err)
|
||||
} else if !HashEquals(srcSum, dstSum) {
|
||||
Stats.Error()
|
||||
err = errors.Errorf("corrupted on transfer: %v hash differ %q vs %q", hashType, srcSum, dstSum)
|
||||
ErrorLog(dst, "%s", err)
|
||||
ErrorLog(dst, "%v", err)
|
||||
removeFailedCopy(dst)
|
||||
return
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ func DeleteFile(dst Object) {
|
|||
Stats.DoneChecking(dst)
|
||||
if err != nil {
|
||||
Stats.Error()
|
||||
ErrorLog(dst, "Couldn't delete: %s", err)
|
||||
ErrorLog(dst, "Couldn't delete: %v", err)
|
||||
} else {
|
||||
Debug(dst, "Deleted")
|
||||
}
|
||||
|
|
|
@ -612,7 +612,7 @@ func (o *Object) readMetaData() (err error) {
|
|||
func (o *Object) ModTime() time.Time {
|
||||
err := o.readMetaData()
|
||||
if err != nil {
|
||||
// fs.Log(o, "Failed to read metadata: %s", err)
|
||||
// fs.Log(o, "Failed to read metadata: %v", err)
|
||||
return time.Now()
|
||||
}
|
||||
return o.modTime
|
||||
|
|
|
@ -663,7 +663,7 @@ func (o *Object) Hash(t fs.HashType) (string, error) {
|
|||
func (o *Object) Size() int64 {
|
||||
err := o.readMetaData()
|
||||
if err != nil {
|
||||
fs.Log(o, "Failed to read metadata: %s", err)
|
||||
fs.Log(o, "Failed to read metadata: %v", err)
|
||||
return 0
|
||||
}
|
||||
return o.size
|
||||
|
@ -720,7 +720,7 @@ func (o *Object) readMetaData() (err error) {
|
|||
func (o *Object) ModTime() time.Time {
|
||||
err := o.readMetaData()
|
||||
if err != nil {
|
||||
fs.Log(o, "Failed to read metadata: %s", err)
|
||||
fs.Log(o, "Failed to read metadata: %v", err)
|
||||
return time.Now()
|
||||
}
|
||||
return o.modTime
|
||||
|
|
6
s3/s3.go
6
s3/s3.go
|
@ -699,7 +699,7 @@ func (o *Object) readMetaData() (err error) {
|
|||
o.bytes = size
|
||||
o.meta = resp.Metadata
|
||||
if resp.LastModified == nil {
|
||||
fs.Log(o, "Failed to read last modified from HEAD: %s", err)
|
||||
fs.Log(o, "Failed to read last modified from HEAD: %v", err)
|
||||
o.lastModified = time.Now()
|
||||
} else {
|
||||
o.lastModified = *resp.LastModified
|
||||
|
@ -714,7 +714,7 @@ func (o *Object) readMetaData() (err error) {
|
|||
func (o *Object) ModTime() time.Time {
|
||||
err := o.readMetaData()
|
||||
if err != nil {
|
||||
fs.Log(o, "Failed to read metadata: %s", err)
|
||||
fs.Log(o, "Failed to read metadata: %v", err)
|
||||
return time.Now()
|
||||
}
|
||||
// read mtime out of metadata if available
|
||||
|
@ -725,7 +725,7 @@ func (o *Object) ModTime() time.Time {
|
|||
}
|
||||
modTime, err := swift.FloatStringToTime(*d)
|
||||
if err != nil {
|
||||
fs.Log(o, "Failed to read mtime from object: %s", err)
|
||||
fs.Log(o, "Failed to read mtime from object: %v", err)
|
||||
return o.lastModified
|
||||
}
|
||||
return modTime
|
||||
|
|
|
@ -580,7 +580,7 @@ func (o *Object) ModTime() time.Time {
|
|||
}
|
||||
modTime, err := o.headers.ObjectMetadata().GetModTime()
|
||||
if err != nil {
|
||||
// fs.Log(o, "Failed to read mtime from object: %s", err)
|
||||
// fs.Log(o, "Failed to read mtime from object: %v", err)
|
||||
return o.info.LastModified
|
||||
}
|
||||
return modTime
|
||||
|
|
|
@ -477,7 +477,7 @@ func (o *Object) Size() int64 {
|
|||
func (o *Object) ModTime() time.Time {
|
||||
err := o.readMetaData()
|
||||
if err != nil {
|
||||
fs.Log(o, "Failed to read metadata: %s", err)
|
||||
fs.Log(o, "Failed to read metadata: %v", err)
|
||||
return time.Now()
|
||||
}
|
||||
return o.modTime
|
||||
|
|
Loading…
Reference in a new issue