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

Error level includes Error() of err #1

Merged
merged 1 commit into from
Mar 14, 2022
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
2 changes: 1 addition & 1 deletion buflogr.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (l *bufLogger) Info(level int, msg string, kv ...interface{}) {
// Error implements logr.Logger.Error by prefixing the line with "ERROR" and
// write it to the internal buffer.
func (l *bufLogger) Error(err error, msg string, kv ...interface{}) {
l.writeLine(LevelError, msg, kv...)
l.writeLine(fmt.Sprintf("%s %v", LevelError, err), msg, kv...)
}

// WithValues returns a new LogSink with additional key/value pairs.
Expand Down
4 changes: 2 additions & 2 deletions example/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func ExampleNew() {
// INFO MyName hello module example val1 1 val2 map[k:1]
// V[1] MyName you should see this module example
// V[2] MyName you will also see this module example
// ERROR MyName uh oh module example trouble true reasons [0.1 0.11 3.14]
// ERROR MyName goodbye module example code -1
// ERROR <nil> MyName uh oh module example trouble true reasons [0.1 0.11 3.14]
// ERROR an error occurred MyName goodbye module example code -1
// INFO MyName thru a helper module example
}

Expand Down