Skip to content

Fix logging example in docs to include required StreamHandler #2605

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jnowakowski
Copy link

The logging example in the documentation previously set the log level but did not include a handler, which can result in no output being shown in many environments (e.g., terminal, script execution).

This PR improves the example by:

  • Adding a StreamHandler configured to write to sys.stdout
  • Including a formatter to make the output more readable

This change improves developer experience, especially for those new to the library or debugging API calls.

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #2604

@jnowakowski jnowakowski requested a review from a team as a code owner May 19, 2025 09:00
Copy link

google-cla bot commented May 19, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label May 19, 2025
The previous logging example set the log level but did not include a StreamHandler,
causing no output in many environments. This fix adds a StreamHandler and formatter
to ensure logs are visible in terminal/script use.
@ohmayr ohmayr added priority: p2 Moderately-important priority. Fix may not be included in next release. type: process A process-related concern. May include testing, release, or the like. labels May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. size: s Pull request size is small. type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging example does not output anything without a StreamHandler
3 participants