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

API: Remove stuttering and consider error for options #2

Closed
embano1 opened this issue Jan 11, 2023 · 1 comment
Closed

API: Remove stuttering and consider error for options #2

embano1 opened this issue Jan 11, 2023 · 1 comment
Assignees

Comments

@embano1
Copy link

embano1 commented Jan 11, 2023

Just out of my own experience using functional options (+1 on using them!) I recommend that you remove the Logger prefix in the options and add an error to the Option definition so you can handle invalid values, etc. without breaking the API at a later stage.

func LoggerWithLogVerbosity(verbosity int) LoggerOptions {

@jpmcb jpmcb self-assigned this Jan 11, 2023
@jpmcb
Copy link
Owner

jpmcb commented Jan 22, 2023

Pushed e7212f4 which introduces returning errors to logger options and reformats logger options to drop the Logger* format:

l, err := gopherlogs.NewLogger(
    gopherlogs.WithLogLevel(0),
)
if err != nil {
    panic("New logger could not be created!")
}

@jpmcb jpmcb closed this as completed Jan 22, 2023
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

No branches or pull requests

2 participants