-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add logging #13
Conversation
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) |
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.
ここらへんのログを全部.debug
でまとめてresponse = await self.session ...
の下に置かない?
そしたら、これからエラーが増えた時にいちいち書かなくて済むし、loggerを標準出力に出すようにしてたときに、.error
とraise
で二重にエラーが出なくて済む。
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.
そうだね
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) |
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.
method
とpath
もやった方がわかりやすいかも。
後、ステータスコードとか。
リクエストする前にリクエストのログをRequest: {method}: {path}: {kwargs}
みたいにして、リクエスト後にレスポンスのログをResponse: {0.status_code}: {0.content}
みたいにすれば。
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}") |
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.
ステータスコードもあった方がいいんじゃない。
logger.debug(f"Response: {response.content}") | |
logger.debug("Response: {0.status_code}: {0.content}".format(response)) |
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.
せやな
No description provided.