feat(logging)!: add client & worker option to pass a custom logger #1171
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
We're actively using and building on Hatchet and enjoy it a lot. Not being able to plug our logger into the system is an issue for us though. This PR aims to provide a solution that seamlessly fits into the existing Hatchet SDK.
Adds
WithLogger()
option to the client and worker. The option replaces theWithLogLevel()
option as its possible to supply a logger with the desired log-level and pass it toWithLogger()
.Note: Since the removal of
WithLogLevel
technically is a breaking change, I'd be fine with rolling this part back despite the functional redundancy.Note: PR is incomplete on purpose; wanted to validate the contribution before completing it.
Relates to #1170
Examples
Setting a custom logger:
Type of change
What's Changed
client.WithLogger
optionclient.WithLogLevel
optionworker.WithLogger
optionworker.WithLogLevel
optionExtra
Thank you for building Hatchet, really enjoy working with it and I'd love to contribute more in the future. Cheers to you guys :)