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

Add nop logger #3198

Merged
merged 1 commit into from
Oct 12, 2022
Merged

Add nop logger #3198

merged 1 commit into from
Oct 12, 2022

Conversation

phillebaba
Copy link
Member

This change adds a discard implementation of the logger interface which is useful for testing purposes.

pkg/log/log.go Outdated
@@ -30,3 +30,17 @@ type Logger interface {
// Failuref logs a formatted failure message.
Failuref(format string, a ...interface{})
}

type DiscardLogger struct{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this to a new file e.g. nop.go and rename the type to NopLogger like zap does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't simply log.Discard make more sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My above comment wasn't taken into account when this was merged.

@phillebaba phillebaba changed the title Add discard logger Add nop logger Oct 12, 2022

Verified

This commit was signed with the committer’s verified signature.
eps1lon Sebastian "Sebbie" Silbermann
Signed-off-by: Philip Laine <philip.laine@gmail.com>
@phillebaba phillebaba merged commit 2282223 into main Oct 12, 2022
@phillebaba phillebaba deleted the discard-logger branch October 12, 2022 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants