Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
daspecster
commented
Oct 24, 2016
@dhermes, did you try this on the service and confirm that the data gets logged correctly? |
dhermes
commented
Oct 24, 2016
>>>fromgoogle.cloudimportlogging>>>client=logging.Client()
>>>logger=client.logger('errors')
>>>>>>payload= {
... 'a': {
... 'b': 'c',
... }
... }
>>>logger.log_struct(payload)
>>> |
waprin
commented
Oct 24, 2016
@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().
dhermes
commented
Oct 24, 2016
@waprin Good find on |
waprin
commented
Oct 24, 2016
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?