aboutsummaryrefslogtreecommitdiff
path: root/sketch/sketch.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 /sketch/sketch.go
parentd85847ec99d44e1010a95c71579a754ac9f7c646 (diff)
downloaddna-backup-33967236e18c33d0d83b34b76f8238c3d588b21d.tar.gz
dna-backup-33967236e18c33d0d83b34b76f8238c3d588b21d.zip
logger add panic + colors & remove ln variants & use it
Diffstat (limited to 'sketch/sketch.go')
-rw-r--r--sketch/sketch.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/sketch/sketch.go b/sketch/sketch.go
index 12e62fa..ca8c238 100644
--- a/sketch/sketch.go
+++ b/sketch/sketch.go
@@ -4,10 +4,10 @@ import (
"bytes"
"encoding/binary"
"io"
- "log"
"sync"
"github.com/chmduquesne/rollinghash/rabinkarp64"
+ "github.com/n-peugnet/dna-backup/logger"
)
type Sketch []uint64
@@ -31,13 +31,13 @@ func SketchChunk(r io.Reader, pol rabinkarp64.Pol, chunkSize int, wSize int, sfC
sfBuff := make([]byte, fBytes*fCount)
chunkLen, err := chunk.ReadFrom(r)
if err != nil {
- log.Panicln(chunkLen, err)
+ logger.Panic(chunkLen, err)
}
for f := 0; f < int(chunkLen)/fSize; f++ {
var fBuff bytes.Buffer
n, err := io.CopyN(&fBuff, &chunk, int64(fSize))
if err != nil {
- log.Println(n, err)
+ logger.Error(n, err)
continue
}
features = append(features, 0)
@@ -62,7 +62,7 @@ func calcFeature(wg *sync.WaitGroup, p rabinkarp64.Pol, r ReadByteReader, wSize
hasher := rabinkarp64.NewFromPol(p)
n, err := io.CopyN(hasher, r, int64(wSize))
if err != nil {
- log.Println(n, err)
+ logger.Error(n, err)
}
max := hasher.Sum64()
for w := 0; w < fSize-wSize; w++ {