mirror of
https://github.com/restic/restic.git
synced 2025-08-12 19:07:40 +00:00
debug: Remove manual Str() call Log()
This commit is contained in:
@@ -59,9 +59,9 @@ func (r *Reader) Archive(ctx context.Context, name string, rd io.Reader, p *rest
|
||||
if err != nil {
|
||||
return nil, restic.ID{}, err
|
||||
}
|
||||
debug.Log("saved blob %v (%d bytes)\n", id.Str(), chunk.Length)
|
||||
debug.Log("saved blob %v (%d bytes)\n", id, chunk.Length)
|
||||
} else {
|
||||
debug.Log("blob %v already saved in the repo\n", id.Str())
|
||||
debug.Log("blob %v already saved in the repo\n", id)
|
||||
}
|
||||
|
||||
freeBuf(chunk.Data)
|
||||
@@ -94,14 +94,14 @@ func (r *Reader) Archive(ctx context.Context, name string, rd io.Reader, p *rest
|
||||
return nil, restic.ID{}, err
|
||||
}
|
||||
sn.Tree = &treeID
|
||||
debug.Log("tree saved as %v", treeID.Str())
|
||||
debug.Log("tree saved as %v", treeID)
|
||||
|
||||
id, err := repo.SaveJSONUnpacked(ctx, restic.SnapshotFile, sn)
|
||||
if err != nil {
|
||||
return nil, restic.ID{}, err
|
||||
}
|
||||
|
||||
debug.Log("snapshot saved as %v", id.Str())
|
||||
debug.Log("snapshot saved as %v", id)
|
||||
|
||||
err = repo.Flush(ctx)
|
||||
if err != nil {
|
||||
|
@@ -95,20 +95,20 @@ func (arch *Archiver) isKnownBlob(id restic.ID, t restic.BlobType) bool {
|
||||
|
||||
// Save stores a blob read from rd in the repository.
|
||||
func (arch *Archiver) Save(ctx context.Context, t restic.BlobType, data []byte, id restic.ID) error {
|
||||
debug.Log("Save(%v, %v)\n", t, id.Str())
|
||||
debug.Log("Save(%v, %v)\n", t, id)
|
||||
|
||||
if arch.isKnownBlob(id, restic.DataBlob) {
|
||||
debug.Log("blob %v is known\n", id.Str())
|
||||
debug.Log("blob %v is known\n", id)
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := arch.repo.SaveBlob(ctx, t, data, id)
|
||||
if err != nil {
|
||||
debug.Log("Save(%v, %v): error %v\n", t, id.Str(), err)
|
||||
debug.Log("Save(%v, %v): error %v\n", t, id, err)
|
||||
return err
|
||||
}
|
||||
|
||||
debug.Log("Save(%v, %v): new blob\n", t, id.Str())
|
||||
debug.Log("Save(%v, %v): new blob\n", t, id)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ func (arch *Archiver) saveChunk(ctx context.Context, chunk chunker.Chunk, p *res
|
||||
err := arch.Save(ctx, restic.DataBlob, chunk.Data, id)
|
||||
// TODO handle error
|
||||
if err != nil {
|
||||
debug.Log("Save(%v) failed: %v", id.Str(), err)
|
||||
debug.Log("Save(%v) failed: %v", id, err)
|
||||
fmt.Printf("\nerror while saving data to the repo: %+v\n", err)
|
||||
panic(err)
|
||||
}
|
||||
@@ -204,7 +204,7 @@ func updateNodeContent(node *restic.Node, results []saveResult) error {
|
||||
node.Content[i] = b.id
|
||||
bytes += b.bytes
|
||||
|
||||
debug.Log(" adding blob %s, %d bytes", b.id.Str(), b.bytes)
|
||||
debug.Log(" adding blob %s, %d bytes", b.id, b.bytes)
|
||||
}
|
||||
|
||||
if bytes != node.Size {
|
||||
@@ -304,7 +304,7 @@ func (arch *Archiver) fileWorker(ctx context.Context, wg *sync.WaitGroup, p *res
|
||||
contentMissing := false
|
||||
for _, blob := range oldNode.Content {
|
||||
if !arch.repo.Index().Has(blob, restic.DataBlob) {
|
||||
debug.Log(" %v not using old data, %v is missing", e.Path(), blob.Str())
|
||||
debug.Log(" %v not using old data, %v is missing", e.Path(), blob)
|
||||
contentMissing = true
|
||||
break
|
||||
}
|
||||
@@ -437,7 +437,7 @@ func (arch *Archiver) dirWorker(ctx context.Context, wg *sync.WaitGroup, p *rest
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
debug.Log("save tree for %s: %v", dir.Path(), id.Str())
|
||||
debug.Log("save tree for %s: %v", dir.Path(), id)
|
||||
if id.IsNull() {
|
||||
panic("invalid null subtree restic.ID return from SaveTreeJSON()")
|
||||
}
|
||||
@@ -770,7 +770,7 @@ func (arch *Archiver) Snapshot(ctx context.Context, p *restic.Progress, paths, t
|
||||
|
||||
// receive the top-level tree
|
||||
root := (<-resCh).(*restic.Node)
|
||||
debug.Log("root node received: %v", root.Subtree.Str())
|
||||
debug.Log("root node received: %v", root.Subtree)
|
||||
sn.Tree = root.Subtree
|
||||
|
||||
// load top-level tree again to see if it is empty
|
||||
@@ -798,7 +798,7 @@ func (arch *Archiver) Snapshot(ctx context.Context, p *restic.Progress, paths, t
|
||||
return nil, restic.ID{}, err
|
||||
}
|
||||
|
||||
debug.Log("saved snapshot %v", id.Str())
|
||||
debug.Log("saved snapshot %v", id)
|
||||
|
||||
return sn, id, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user