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: Log the response body when the request succeeds with LogLevel.DEBUG #479

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export default class Client {

const responseJson: ResponseBody = JSON.parse(responseText)
this.log(LogLevel.INFO, `request success`, { method, path })
this.log(LogLevel.DEBUG, `succeed response body`, { body: responseText })

Choose a reason for hiding this comment

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

could you make this consistent with the previous log?

Suggested change
this.log(LogLevel.DEBUG, `succeed response body`, { body: responseText })
this.log(LogLevel.DEBUG, `response body success`, { body: responseText })

Copy link
Author

Choose a reason for hiding this comment

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

Hello @varunrau! Thank you for the comment.

I believe your opinion is appropriate, but I have added it to align with the pattern seen in the after log, especially considering the 230-241 lines handling errors.

When an error occurs in the request

  • request fail -> failed response body

When the request is succeeded

  • request success -> succeeded response body (what I added)

return responseJson
} catch (error: unknown) {
if (!isNotionClientError(error)) {
Expand Down