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

Add logging #13

Merged
merged 7 commits into from
Mar 18, 2023
Merged

Add logging #13

merged 7 commits into from
Mar 18, 2023

Conversation

tuna2134
Copy link
Member

No description provided.

@tuna2134 tuna2134 added the enhancement New feature or request label Mar 16, 2023
@tuna2134 tuna2134 self-assigned this Mar 16, 2023
@tuna2134 tuna2134 linked an issue Mar 17, 2023 that may be closed by this pull request
@tuna2134 tuna2134 closed this Mar 17, 2023
@tuna2134 tuna2134 reopened this Mar 17, 2023
@tuna2134 tuna2134 requested a review from tasuren March 17, 2023 13:01
voicevox/http.py Show resolved Hide resolved
voicevox/http.py Outdated
@@ -24,8 +31,10 @@ async def request(self, method: str, path: str, **kwargs) -> dict:
else:
return response.content
elif response.status_code == 404:
logger.debug(response.content)
Copy link

Choose a reason for hiding this comment

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

ここらへんのログを全部.debugでまとめてresponse = await self.session ...の下に置かない?
そしたら、これからエラーが増えた時にいちいち書かなくて済むし、loggerを標準出力に出すようにしてたときに、.errorraiseで二重にエラーが出なくて済む。

Copy link
Member Author

Choose a reason for hiding this comment

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

そうだね

@tuna2134 tuna2134 requested a review from tasuren March 17, 2023 23:35
voicevox/http.py Outdated
await self.session.aclose()

async def request(self, method: str, path: str, **kwargs) -> dict:
response = await self.session.request(method, path, **kwargs)
logger.debug(response.content)
Copy link

Choose a reason for hiding this comment

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

methodpathもやった方がわかりやすいかも。
後、ステータスコードとか。
リクエストする前にリクエストのログをRequest: {method}: {path}: {kwargs}みたいにして、リクエスト後にレスポンスのログをResponse: {0.status_code}: {0.content}みたいにすれば。

@tuna2134 tuna2134 requested a review from tasuren March 18, 2023 00:17
tasuren
tasuren previously approved these changes Mar 18, 2023
voicevox/http.py Show resolved Hide resolved
voicevox/http.py Outdated
logger.debug(f"Request: {method} Path: {path} kwargs: {kwargs}")
response = await self.session.request(method, path, **kwargs)
logger.debug(f"Response: {response.content}")
Copy link

Choose a reason for hiding this comment

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

ステータスコードもあった方がいいんじゃない。

Suggested change
logger.debug(f"Response: {response.content}")
logger.debug("Response: {0.status_code}: {0.content}".format(response))

Copy link
Member Author

Choose a reason for hiding this comment

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

せやな

@tuna2134 tuna2134 requested a review from tasuren March 18, 2023 01:04
@tuna2134 tuna2134 merged commit 6eca1f6 into voicevox-client:main Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add logging
2 participants