Skip to content

Fix: Use log instead of fmt #1706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions cmd/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ WAIT:
case s := <-signalCh:
sig = s
case err := <-agent.RetryJoinCh():
fmt.Println("[ERR] agent: Retry join failed: ", err)
log.WithError(err).Error("agent: Retry join failed")
return 1
case <-ShutdownCh:
sig = os.Interrupt
}
fmt.Printf("Caught signal: %v", sig)
log.Infof("Caught signal: %v", sig)

// Check if this is a SIGHUP
if sig == syscall.SIGHUP {
Expand All @@ -111,8 +111,7 @@ WAIT:
log.Info("agent: Gracefully shutting down agent...")
go func() {
if err := agent.Stop(); err != nil {
fmt.Printf("Error: %s", err)
log.Error(fmt.Sprintf("Error: %s", err))
log.WithError(err).Error("unable to stop agent")
return
}
}()
Expand Down Expand Up @@ -145,7 +144,7 @@ WAIT:

// handleReload is invoked when we should reload our configs, e.g. SIGHUP
func handleReload() {
fmt.Println("Reloading configuration...")
log.Info("Reloading configuration...")
initConfig()
//Config reloading will also reload Notification settings
agent.UpdateTags(config.Tags)
Expand Down
3 changes: 2 additions & 1 deletion cmd/keygen.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand All @@ -26,7 +27,7 @@ var keygenCmd = &cobra.Command{
return errors.New("couldn't read enough entropy. Generate more entropy")
}

fmt.Println(base64.StdEncoding.EncodeToString(key))
log.Info(base64.StdEncoding.EncodeToString(key))
return nil
},
}
Expand Down
1 change: 1 addition & 0 deletions cmd/leave.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var leaveCmd = &cobra.Command{
return err
}

log.Info("Left the cluster successfully")
return nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var raftRemovePeerCmd = &cobra.Command{
if err := gc.RaftRemovePeerByID(ip, peerID); err != nil {
return err
}
fmt.Println("Peer removed")
log.Info("Peer removed")

return nil
},
Expand Down
Loading