-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allowing for arbitrarily nested dictionaries in _log_entry_mapping_pb. #2589
Conversation
# NOTE: ``json.dumps`` is wasteful here because internally, | ||
# ``Parse`` will just call ``json.loads``. However, | ||
# there is no equivalent public function to parse on raw | ||
# dictionaries, so we waste cycles on parse/unparse. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@dhermes, did you try this on the service and confirm that the data gets logged correctly? |
>>> from google.cloud import logging
>>> client = logging.Client()
>>> logger = client.logger('errors')
>>>
>>> payload = {
... 'a': {
... 'b': 'c',
... }
... }
>>> logger.log_struct(payload)
>>> |
@dhermes thanks for figuring this out for me, works for me. As for system test, I think it'd be trivial to add it just by adding one level of nesting to the current log_struct system test. |
Also using ParseDict() instead of Parse() and a wasted json.dumps().
@waprin Good find on |
LGTM! |
Allowing for arbitrarily nested dictionaries in _log_entry_mapping_pb.
Fixes #2552.
@waprin Do you think it's worthwhile to add a system test for this / update an existing system test with a nested dictionary?