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

@daniel-sanche daniel-sanche commented Dec 8, 2020

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 as code owners Dec 8, 2020
@google-cla google-cla bot added the cla: yes label Dec 8, 2020
@product-auto-label product-auto-label bot added the api: logging label Dec 8, 2020
@daniel-sanche daniel-sanche added the lang: python label Dec 8, 2020
@daniel-sanche
Copy link
Contributor Author

@daniel-sanche daniel-sanche commented Dec 8, 2020

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

Copy link
Collaborator

@busunkim96 busunkim96 left a comment

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
8 checks passed
@daniel-sanche daniel-sanche deleted the fix-handler-path branch Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging cla: yes lang: python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants