Skip to content

Commit

Permalink
Merge pull request #2 from thockin/master
Browse files Browse the repository at this point in the history
Get rid of InfoLogger, implement V() as additive
  • Loading branch information
thockin authored Jun 11, 2020
2 parents 4d96433 + ee0248e commit 12d3571
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func main() {
log = log.WithName("MyName").WithValues("user", "you")
log.Info("hello", "val1", 1, "val2", map[string]int{"k": 1})
log.V(1).Info("you should see this")
log.V(3).Info("you should NOT see this")
log.V(1).V(1).Info("you should NOT see this")
log.Error(nil, "uh oh", "trouble", true, "reasons", []float64{0.1, 0.11, 3.14})
log.Error(E{"an error occurred"}, "goodbye", "code", -1)
}
5 changes: 2 additions & 3 deletions stdr.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ func (l logger) output(calldepth int, s string) {
}
}

func (l logger) V(level int) logr.InfoLogger {
func (l logger) V(level int) logr.Logger {
new := l.clone()
new.level = level
new.level += level
return new
}

Expand All @@ -221,4 +221,3 @@ func (l logger) WithValues(kvList ...interface{}) logr.Logger {
}

var _ logr.Logger = logger{}
var _ logr.InfoLogger = logger{}

0 comments on commit 12d3571

Please sign in to comment.