Skip to content

Conversation

@teodora-sandu
Copy link
Contributor

@teodora-sandu teodora-sandu commented Apr 18, 2024

Forgot to re-init the error reporter logger with the provided logger and while I was looking at the http client I wanted to refactor the logic a bit so it's easier to follow.

@teodora-sandu teodora-sandu requested a review from a team as a code owner April 18, 2024 16:20
@teodora-sandu teodora-sandu force-pushed the refactor/http-logger-option branch from 9ae2ace to e1b33cc Compare April 18, 2024 17:03
http/http.go Outdated
copyReqBody = io.NopCloser(bytes.NewBuffer(reqBuf))
req.Body = reqBody
s.logger.Debug().Str("url", req.URL.String()).Str("snyk-request-id", requestId).Str("requestBody", string(reqBuf)).Msg("SEND TO REMOTE")
s.logger.Debug().Str("method", req.Method).Str("url", req.URL.String()).Str("snyk-request-id", requestId).Str("requestBody", string(reqBuf)).Msg("SEND TO REMOTE")
Copy link
Contributor

Choose a reason for hiding this comment

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

this would overwrite the "method" attribute in the logger defined in line 129. Maybe call it "requestMethod"?

Also I'd advise against outputting the requestBody in debug mode - this would log the complete repository source code, when uploading files for analysis.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good point, I've just updated the PR to do what you suggested. Could you have another look please?

@teodora-sandu teodora-sandu force-pushed the refactor/http-logger-option branch from e1b33cc to c649e04 Compare April 19, 2024 12:03
@teodora-sandu teodora-sandu force-pushed the refactor/http-logger-option branch from c649e04 to 1dfe08c Compare April 19, 2024 15:41
@teodora-sandu teodora-sandu merged commit 54250ef into main Apr 19, 2024
@teodora-sandu teodora-sandu deleted the refactor/http-logger-option branch April 19, 2024 15:49
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.

3 participants