Use github.com/rs/zerolog for logging (#1255)

* Use `github.com/rs/zerolog` for logging

* Use `github.com/rs/zerolog` for logging (continue)

* Add `debug` flag

* Remove `github.com/op/go-logging` dependency completely

* Fix linter
This commit is contained in:
M. Mert Yildiran
2022-11-28 16:48:20 -08:00
committed by GitHub
parent 10a9b5a3d7
commit 86fd616b84
36 changed files with 511 additions and 318 deletions

View File

@@ -4,12 +4,11 @@ import (
"context"
"errors"
"fmt"
"log"
"sync"
"time"
"github.com/kubeshark/kubeshark/debounce"
"github.com/rs/zerolog/log"
"k8s.io/apimachinery/pkg/watch"
)
@@ -57,13 +56,13 @@ func FilteredWatch(ctx context.Context, watcherCreator WatchCreator, targetNames
} else {
if !watchRestartDebouncer.IsOn() {
if err := watchRestartDebouncer.SetOn(); err != nil {
log.Print(err)
log.Error().Err(err)
}
log.Print("k8s watch channel closed, restarting watcher")
log.Warn().Msg("K8s watch channel closed, restarting watcher...")
time.Sleep(time.Second * 5)
continue
} else {
errorChan <- errors.New("k8s watch unstable, closes frequently")
errorChan <- errors.New("K8s watch unstable, closes frequently")
break
}
}