Start to use leveled log

This commit is contained in:
2022-02-24 12:14:52 +01:00
parent f18cc034bb
commit abcf02e488
43 changed files with 156 additions and 67 deletions

View File

@ -2,7 +2,7 @@ package obiformats
import (
"fmt"
"log"
log "github.com/sirupsen/logrus"
"sync"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"

View File

@ -5,7 +5,7 @@ import (
"encoding/csv"
"fmt"
"io"
"log"
log "github.com/sirupsen/logrus"
"os"
"strconv"
"strings"

View File

@ -5,7 +5,7 @@ import (
"bytes"
"compress/gzip"
"io"
"log"
log "github.com/sirupsen/logrus"
"os"
"strconv"
"strings"

View File

@ -1,7 +1,7 @@
package obiformats
import (
"log"
log "github.com/sirupsen/logrus"
"strings"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"

View File

@ -8,10 +8,11 @@ import "C"
import (
"fmt"
"log"
"os"
"unsafe"
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/cutils"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
@ -61,7 +62,7 @@ func _FastseqReader(seqfile C.fast_kseq_p,
slice = append(slice, rep)
ii++
if ii >= batch_size {
// log.Printf("\n==> Pushing sequence batch\n")
//log.Printf("\n==> Pushing sequence batch\n")
// start := time.Now()
iterator.Push(obiiter.MakeBioSequenceBatch(i, slice))
@ -100,7 +101,7 @@ func ReadFastSeqBatchFromFile(filename string, options ...WithOption) (obiiter.I
fi, err := os.Stat(filename)
if err == nil {
size = fi.Size()
log.Printf("File size of %s is %d bytes\n", filename, size)
log.Debugf("File size of %s is %d bytes\n", filename, size)
} else {
size = -1
}
@ -110,10 +111,10 @@ func ReadFastSeqBatchFromFile(filename string, options ...WithOption) (obiiter.I
go func() {
newIter.WaitAndClose()
log.Println("End of the fastq file reading")
log.Debugln("End of the fastq file reading")
}()
log.Println("Start of the fastq file reading")
log.Debugln("Start of the fastq file reading")
go _FastseqReader(pointer, newIter, opt.BatchSize())
parser := opt.ParseFastSeqHeader()

View File

@ -4,10 +4,11 @@ import (
"bytes"
"fmt"
"io"
"log"
"os"
"strings"
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
)
@ -114,6 +115,7 @@ func WriteFastaBatch(iterator obiiter.IBioSequenceBatch,
go func() {
newIter.WaitAndClose()
close(chunkchan)
log.Debugln("End of the fasta file writing")
}()
ff := func(iterator obiiter.IBioSequenceBatch) {
@ -128,7 +130,7 @@ func WriteFastaBatch(iterator obiiter.IBioSequenceBatch,
newIter.Done()
}
log.Println("Start of the fasta file writing")
log.Debugln("Start of the fasta file writing")
go ff(iterator)
for i := 0; i < nwriters-1; i++ {
go ff(iterator.Split())

View File

@ -4,10 +4,11 @@ import (
"bytes"
"fmt"
"io"
"log"
"os"
"time"
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
)
@ -114,6 +115,7 @@ func WriteFastqBatch(iterator obiiter.IBioSequenceBatch,
time.Sleep(time.Millisecond)
}
close(chunkchan)
log.Debugln("End of the fastq file writing")
}()
ff := func(iterator obiiter.IBioSequenceBatch) {
@ -129,7 +131,7 @@ func WriteFastqBatch(iterator obiiter.IBioSequenceBatch,
newIter.Done()
}
log.Println("Start of the fastq file writing")
log.Debugln("Start of the fastq file writing")
go ff(iterator)
for i := 0; i < nwriters-1; i++ {
go ff(iterator.Split())

View File

@ -5,7 +5,7 @@ import (
"encoding/csv"
"fmt"
"io"
"log"
log "github.com/sirupsen/logrus"
"os"
"path"
"strconv"

View File

@ -4,10 +4,11 @@ import (
"bufio"
"compress/gzip"
"io"
"log"
"os"
"strings"
log "github.com/sirupsen/logrus"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
)
@ -57,7 +58,7 @@ func ReadSequencesBatchFromFile(filename string,
if err != nil {
file.Seek(0, 0)
} else {
log.Printf("File %s is gz compressed ", filename)
log.Debugf("File %s is gz compressed ", filename)
reader = greader
}
@ -72,7 +73,7 @@ func ReadSequencesBatchFromFile(filename string,
}
filetype := GuessSeqFileType(string(tag))
log.Printf("File guessed format : %s (tag: %s)",
log.Debug("File guessed format : %s (tag: %s)",
filetype, (strings.Split(string(tag), "\n"))[0])
reader = breader

View File

@ -3,7 +3,7 @@ package obiformats
import (
"fmt"
"io"
"log"
log "github.com/sirupsen/logrus"
"os"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"