I had an exact problem just like yours. My application was running on the Django framework, So I created middleware to manage logs nesting and started logging via Google Cloud Logging API using "google-cloud-logging" library.
Google Cloud Loggin API documentation does not have a good document on this.
While creating a log you need to add "TRACE" This trace should be pointing to its parent log.
I was able to achieve the following results:
Please check my step by step blog on implementing this solution here
Please check the repository source code here on Github.