我正在研究一个在Python运行时中运行的简单Google Cloud Function,并且我希望从Python程序到Stackdriver Logging进行一些简单的日志记录。
根据Google的启动指南,此操作应该很简单 https://cloud.google.com/logging/docs/setup/python
我设置了一个简单的测试功能来隔离我看到的日志记录问题
import google.cloud.logging
def logging_test_background(data, context):
logging_client = google.cloud.logging.Client()
logging_client.setup_logging()
logging.info("This should be info")
logging.debug("This should be debug")
logging.warning("This should be warning")
logging.error("This should be error")
Run Code Online (Sandbox Code Playgroud)
在Stackdriver Logging中,一切变得混乱。
1.信息被复制为错误2.调试未通过3.警告被复制,但是两者均为错误记录级别4.错误被复制
我的配置中缺少什么吗?
python google-cloud-platform google-cloud-functions google-cloud-stackdriver