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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add submodule imports for handlers to logging alias #117

Merged
merged 6 commits into from Dec 8, 2020

Conversation

daniel-sanche
Copy link
Contributor

We give users two packages: logging_v2 for the current version of the library, and logging as the alias.

We found the alias was only exporting paths at the library root, which was not what users expected. This meant they could not run
from google.cloud.logging.handlers import CloudLoggingHandler.

Instead they had to run

from google.cloud.logging import handlers
handlers.CloudLoggingHandler

This PR adds more __init__.py files to advertise sub-modules for the handlers. I avoided doing the same for the gapic directories (/proto, /services, /types) because we want to discourage end-users from using auto-generated code

Fixes #115 馃

@daniel-sanche daniel-sanche requested review from a team as code owners December 8, 2020 00:00
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Dec 8, 2020
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/python-logging API. label Dec 8, 2020
@daniel-sanche daniel-sanche added the lang: python Issues specific to Python. label Dec 8, 2020
@daniel-sanche
Copy link
Contributor Author

@busunkim96 let me know if you know a more elegant way to do this

Copy link
Contributor

@busunkim96 busunkim96 left a comment

Choose a reason for hiding this comment

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

This looks good to me. Could you add some unit tests to https://github.com/googleapis/python-logging/blob/master/tests/unit/test_logging_shim.py to make sure this stays in sync with logging_v2.handlers?

@daniel-sanche daniel-sanche merged commit 6843a3a into master Dec 8, 2020
@daniel-sanche daniel-sanche deleted the fix-handler-path branch December 8, 2020 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/python-logging API. cla: yes This human has signed the Contributor License Agreement. lang: python Issues specific to Python.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

handlers is not accessible fromgoogle.cloud.logging
2 participants