mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-18 07:42:20 +00:00
✨ 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:
@@ -2,9 +2,10 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func OpenBrowser(url string) {
|
||||
@@ -22,6 +23,6 @@ func OpenBrowser(url string) {
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Printf("error while opening browser, %v", err)
|
||||
log.Error().Err(err).Msg("While trying to open a browser")
|
||||
}
|
||||
}
|
||||
|
@@ -2,24 +2,25 @@ package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func WaitForFinish(ctx context.Context, cancel context.CancelFunc) {
|
||||
log.Printf("waiting for finish...")
|
||||
log.Debug().Msg("Waiting to finish...")
|
||||
sigChan := make(chan os.Signal, 1)
|
||||
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
||||
|
||||
// block until ctx cancel is called or termination signal is received
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
log.Printf("ctx done")
|
||||
log.Debug().Msg("Context done.")
|
||||
break
|
||||
case <-sigChan:
|
||||
log.Printf("Got termination signal, canceling execution...")
|
||||
log.Debug().Msg("Got a termination signal, canceling execution...")
|
||||
cancel()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user