-
Notifications
You must be signed in to change notification settings - Fork 23
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
🛠️ new logger/zerologadapter
for retryable requests
#4903
Conversation
We use the `retryablehttp` package to retry http requests and we always want the logs to go to `debug` level so, we need an adapter. We have implemented this adapter many times, this change removes all the duplicated code and creates a util package that all providers can use. Example: ```go retryClient := retryablehttp.NewClient() retryClient.Logger = zerologadapter.New(log.Logger) ``` Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice simplification @afiune
Just rebase on main. |
// Copyright (c) Mondoo, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package zerologadapter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this package should be in https://github.com/mondoohq/cnquery/tree/main/logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it inside the providers-sdk/v1
to make it clear that providers can and should use it, Ill move it though.
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
e297c61
to
d0dc2e8
Compare
util/zerologadapter
for retryable requestslogger/zerologadapter
for retryable requests
We use the
retryablehttp
package to retry http requests and we always want the logs to go todebug
level so, we need an adapter.We have implemented this adapter many times, this change removes all the duplicated code and creates a util package that all providers can use.
Example: