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

feat: increase testability #13

Merged
merged 1 commit into from
Dec 5, 2023
Merged

Conversation

Crocmagnon
Copy link
Collaborator

Getting rid of global state is a nice step forward in improving testability.
Caller code (and more importantly tests) can now fully control the registered fields or the logger used to produce messages.

All while not vastly changing the current interface, which keeps the global logging functions it used to have. Those obviously still rely on shared global state.

README.md Outdated

By default, it is initialized to wrap `logrus` package. You can override `log.Factory` to use the logger library you want.
By default, it is initialized to wrap `logrus` package. You can use `log.SetFactory` to use the logger library you want.
Copy link
Contributor

Choose a reason for hiding this comment

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

The feature is interesting but the fact that you replace log.Factory by the function log.SetFactory is a breaking change.
Please keep log.Factory as it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done 👍🏻

Getting rid of global state is a nice step forward in improving
testability.
Caller code (and more importantly tests) can now fully control
the registered fields or the logger used to produce messages.

All while not vastly changing the current interface, which keeps the
global logging functions it used to have. Those obviously still rely on
shared global state.
@fsamin fsamin merged commit 01b6af8 into rockbears:main Dec 5, 2023
1 check passed
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.

2 participants