-
Notifications
You must be signed in to change notification settings - Fork 576
better logging #414
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
better logging #414
Conversation
Summary of ChangesHello @Moshiii, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on refining the client-side logging experience and updating the project's dependency landscape. The logging improvements aim to reduce noise and present output in a more digestible format, particularly for JSON data. Concurrently, the dependency lock file has been comprehensively updated to incorporate newer library versions and integrate new development tools, contributing to a more stable and modern development environment. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
@zeroasterisk @DracoBlue @ehsavoie @whitlockjc Please review. Thanks! |
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.
Code Review
This pull request improves the client-side logging in the helloworld sample by suppressing verbose logs from third-party libraries and enhancing the readability of JSON output. The dependency lock file is also updated to reflect new and updated packages. My review provides a few suggestions to further improve logging consistency and formatting in test_client.py.
| @@ -22,6 +22,11 @@ async def main() -> None: | |||
| # Configure logging to show INFO level messages | |||
| logging.basicConfig(level=logging.INFO) | |||
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.
To make the logging even better and more informative, consider adding a format to your basicConfig. This will give you more control over the log output, including timestamps, which can be very helpful for debugging.
| logging.basicConfig(level=logging.INFO) | |
| logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') |
|
|
||
| response = await client.send_message(request) | ||
| print(response.model_dump(mode='json', exclude_none=True)) | ||
| print(response.model_dump_json(indent=2, exclude_none=True)) |
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.
For consistency with the rest of the logging in this file, consider using logger.info instead of print to output the response. This will ensure all output is uniformly formatted and goes through the configured logging system.
| print(response.model_dump_json(indent=2, exclude_none=True)) | |
| logger.info(response.model_dump_json(indent=2, exclude_none=True)) |
|
|
||
| async for chunk in stream_response: | ||
| print(chunk.model_dump(mode='json', exclude_none=True)) | ||
| print(chunk.model_dump_json(indent=2, exclude_none=True)) |
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.
For consistency with the rest of the logging in this file, consider using logger.info instead of print to output the response chunks. This will ensure all output is uniformly formatted and goes through the configured logging system.
| print(chunk.model_dump_json(indent=2, exclude_none=True)) | |
| logger.info(chunk.model_dump_json(indent=2, exclude_none=True)) |
Description
This is a simple improvement of client side logging format.