在本集中,我们将一些自定义数据记录到 Google Cloud Logging 中。我们演示了一个 Python 示例,该示例使用自定义 gRPC 拦截器将请求和响应数据以及一些元数据(例如成功状态和经过的时间)提取到自定义日志中。然后,我们会使用 Google Cloud Logging API 将这些日志发送到云端。
将客户端日志发送到 Google Cloud
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[[["\u003cp\u003eThis episode demonstrates how to log custom data to Google Cloud Logging using Python.\u003c/p\u003e\n"],["\u003cp\u003eThe example uses a gRPC interceptor to capture request/response data, success status, and elapsed time for logging.\u003c/p\u003e\n"],["\u003cp\u003eCustom logs are generated and sent to Google Cloud using the Google Cloud Logging API.\u003c/p\u003e\n"]]],[],null,["# Sending Client Logs to Google Cloud\n\nIn this episode, we log some custom data to Google Cloud Logging. We walk through a Python example which uses a custom gRPC interceptor to extract request and response data, as well as some metadata like success status and elapsed time, into custom logs. We then send those logs to the cloud using the Google Cloud Logging API.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e"]]