| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| # 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. |
|
@dhermes, did you try this on the service and confirm that the data gets logged correctly? |
Sorry, something went wrong.
>>> from google.cloud import logging
>>> client = logging.Client()
>>> logger = client.logger('errors')
>>>
>>> payload = {
... 'a': {
... 'b': 'c',
... }
... }
>>> logger.log_struct(payload)
>>> |
Sorry, something went wrong.
|
@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. |
Sorry, something went wrong.
Also using ParseDict() instead of Parse() and a wasted json.dumps().
|
@waprin Good find on ParseDict, updated it in the 2nd commit (and also updated the system test). |
Sorry, something went wrong.
|
LGTM! |
Sorry, something went wrong.
Allowing for arbitrarily nested dictionaries in _log_entry_mapping_pb.
| Back | FazBrowse Home | New Git URL |
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?