aboutsummaryrefslogtreecommitdiff
path: root/repo_test.go
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-14 15:37:50 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-14 15:41:44 +0200
commit33967236e18c33d0d83b34b76f8238c3d588b21d (patch)
tree9bd3334b6eabb7cd3b07d7efb9c4c90aa8726a6d /repo_test.go
parentd85847ec99d44e1010a95c71579a754ac9f7c646 (diff)
downloaddna-backup-33967236e18c33d0d83b34b76f8238c3d588b21d.tar.gz
dna-backup-33967236e18c33d0d83b34b76f8238c3d588b21d.zip
logger add panic + colors & remove ln variants & use it
Diffstat (limited to 'repo_test.go')
-rw-r--r--repo_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/repo_test.go b/repo_test.go
index 8748d88..b16ddc6 100644
--- a/repo_test.go
+++ b/repo_test.go
@@ -5,12 +5,12 @@ import (
"fmt"
"io"
"io/ioutil"
- "log"
"os"
"path/filepath"
"reflect"
"testing"
+ "github.com/n-peugnet/dna-backup/logger"
"github.com/n-peugnet/dna-backup/utils"
)
@@ -71,7 +71,7 @@ func (r *Repo) chunkStream(stream io.Reader, chunks chan<- []byte) {
prev += read
}
if err != nil && err != io.EOF {
- log.Println(err)
+ logger.Error(err)
}
if prev == r.chunkSize {
chunks <- buff
@@ -89,7 +89,7 @@ func storeChunks(dest string, chunks <-chan []byte) {
path := filepath.Join(dest, fmt.Sprintf(chunkIdFmt, i))
err := os.WriteFile(path, c, 0664)
if err != nil {
- log.Println(err)
+ logger.Error(err)
}
i++
}
@@ -240,7 +240,7 @@ func TestBsdiff(t *testing.T) {
newChunks := extractDeltaChunks(recipe)
assertLen(t, 2, newChunks, "New delta chunks:")
for _, c := range newChunks {
- log.Println("Patch size:", len(c.Patch))
+ logger.Info("Patch size:", len(c.Patch))
if len(c.Patch) >= repo.chunkSize/10 {
t.Errorf("Bsdiff of chunk is too large: %d", len(c.Patch))
}