Lynn G. Kwong
Jan 26, 2023

--

Hi Kesten, currently `log_struct` does not support logging to the console because google.cloud.logging.Client does not support adding additional handlers.

However, there is an interesting third-party library that can do similar things. It's worth checking it out if this feature is really needed:

- https://github.com/googleapis/python-logging/issues/13#issuecomment-632162417

This thread is also interesting, but it's a bit advanced:

- https://github.com/googleapis/python-logging/issues/13#issuecomment-582833251

For me, if I need this behavior, I will just create a custom logging function in which the logs are sent to the console by the built-in logging (with JSON dumps) and to GCP with log_struct.

--

--

Lynn G. Kwong
Lynn G. Kwong

Written by Lynn G. Kwong

I’m a Software Developer (https://youtube.com/@kwonglynn) keen on sharing thoughts, tutorials, and solutions for the best practice of software development.

No responses yet