Skip to content
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

Update Logger interface #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ func (c *Config) defaults() error {
}

if c.MetricsRecorder == nil {
c.Logger.Warningf("controller metrics disabled")
c.Logger.Warnf("controller metrics disabled")
c.MetricsRecorder = metrics.Dummy
}

if c.Name == "" {
c.Logger.Warningf("controller configured without name")
c.Logger.Warnf("controller configured without name")
}

if c.ListerWatcher == nil {
Expand Down Expand Up @@ -236,7 +236,7 @@ func (c *Controller) retryIfRequired(id string, err error) {
retries, ok := c.objectCache.getRetries(id)
if err != nil && ok && retries < c.cfg.MaxRetries {
// Enqueue again for a new retry.
c.logger.Warningf("retrying (%d/%d) due to an error processing object %s: %s", retries+1, c.cfg.MaxRetries, id, err)
c.logger.Warnf("retrying (%d/%d) due to an error processing object %s: %s", retries+1, c.cfg.MaxRetries, id, err)
c.objectCache.incRetry(id)
c.enqueueObject(id)
return
Expand Down
14 changes: 7 additions & 7 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
// Logger knows how to log messages in the go fmt style.
type Logger interface {
Infof(format string, args ...interface{})
Warningf(format string, args ...interface{})
Warnf(format string, args ...interface{})
Errorf(format string, args ...interface{})
Debugf(format string, args ...interface{})
}
Expand All @@ -18,10 +18,10 @@ var Dummy = &dummy{}

type dummy struct{}

func (dummy) Infof(format string, args ...interface{}) {}
func (dummy) Warningf(format string, args ...interface{}) {}
func (dummy) Errorf(format string, args ...interface{}) {}
func (dummy) Debugf(format string, args ...interface{}) {}
func (dummy) Infof(format string, args ...interface{}) {}
func (dummy) Warnf(format string, args ...interface{}) {}
func (dummy) Errorf(format string, args ...interface{}) {}
func (dummy) Debugf(format string, args ...interface{}) {}

// Std satisfies Logger interface using the standard go logger.
type Std struct {
Expand All @@ -33,8 +33,8 @@ func (s Std) Infof(format string, args ...interface{}) {
log.Printf(fmt.Sprintf("[INFO] %s \n", format), args...)
}

// Warningf satisfies Logger interface.
func (s Std) Warningf(format string, args ...interface{}) {
// Warnf satisfies Logger interface.
func (s Std) Warnf(format string, args ...interface{}) {
log.Printf(fmt.Sprintf("[WARN] %s \n", format), args...)
}

Expand Down