Move entirely to zerolog (#426)

Completely switch to zerolog

(Remove usage of logrus and std logger)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
John Olheiser
2021-10-12 02:25:13 -05:00
committed by GitHub
parent 9c85c8fd68
commit 4276a04f0c
160 changed files with 4982 additions and 397 deletions

View File

@@ -3,12 +3,11 @@ package queue
import (
"container/list"
"context"
"log"
"runtime"
"sync"
"time"
"github.com/sirupsen/logrus"
"github.com/rs/zerolog/log"
)
const (
@@ -237,7 +236,7 @@ func (q *fifo) process() {
const size = 64 << 10
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)]
log.Printf("queue: unexpected panic: %v\n%s", err, buf)
log.Error().Msgf("queue: unexpected panic: %v\n%s", err, buf)
}
}()
@@ -273,7 +272,7 @@ func (q *fifo) filterWaiting() {
nextPending = e.Next()
task := e.Value.(*Task)
if q.depsInQueue(task) {
logrus.Debugf("queue: waiting due to unmet dependencies %v", task.ID)
log.Debug().Msgf("queue: waiting due to unmet dependencies %v", task.ID)
q.waitingOnDeps.PushBack(task)
filtered = append(filtered, e)
}
@@ -290,11 +289,11 @@ func (q *fifo) assignToWorker() (*list.Element, *worker) {
for e := q.pending.Front(); e != nil; e = next {
next = e.Next()
task := e.Value.(*Task)
logrus.Debugf("queue: trying to assign task: %v with deps %v", task.ID, task.Dependencies)
log.Debug().Msgf("queue: trying to assign task: %v with deps %v", task.ID, task.Dependencies)
for w := range q.workers {
if w.filter(task) {
logrus.Debugf("queue: assigned task: %v with deps %v", task.ID, task.Dependencies)
log.Debug().Msgf("queue: assigned task: %v with deps %v", task.ID, task.Dependencies)
return e, w
}
}
@@ -318,7 +317,7 @@ func (q *fifo) depsInQueue(task *Task) bool {
for e := q.pending.Front(); e != nil; e = next {
next = e.Next()
possibleDep, ok := e.Value.(*Task)
logrus.Debugf("queue: pending right now: %v", possibleDep.ID)
log.Debug().Msgf("queue: pending right now: %v", possibleDep.ID)
for _, dep := range task.Dependencies {
if ok && possibleDep.ID == dep {
return true
@@ -326,7 +325,7 @@ func (q *fifo) depsInQueue(task *Task) bool {
}
}
for possibleDepID := range q.running {
logrus.Debugf("queue: running right now: %v", possibleDepID)
log.Debug().Msgf("queue: running right now: %v", possibleDepID)
for _, dep := range task.Dependencies {
if possibleDepID == dep {
return true
@@ -369,13 +368,13 @@ func (q *fifo) updateDepStatusInQueue(taskID string, status string) {
}
func (q *fifo) removeFromPending(taskID string) {
logrus.Debugf("queue: trying to remove %s", taskID)
log.Debug().Msgf("queue: trying to remove %s", taskID)
var next *list.Element
for e := q.pending.Front(); e != nil; e = next {
next = e.Next()
task := e.Value.(*Task)
if task.ID == taskID {
logrus.Debugf("queue: %s is removed from pending", taskID)
log.Debug().Msgf("queue: %s is removed from pending", taskID)
q.pending.Remove(e)
return
}

View File

@@ -246,7 +246,6 @@ func TestFifoErrors2(t *testing.T) {
}
func TestFifoErrorsMultiThread(t *testing.T) {
//logrus.SetLevel(logrus.DebugLevel)
task1 := &Task{
ID: "1",
}