使用灵活环境和NodeJS登录Google App Engine时找不到太多内容。Google App Engine登录NodeJS
作为docs says,可以使用标准stdout
和stderr
编写自己的日志消息。但这是简单的日志记录,我想要更精致一点。
特别是,在谷歌云平台控制台日志查看允许用户在他们的严重性级别过滤日志:
- 关键
- 错误
- 警告
- 信息
- 调试
- 任何对数级别
我想找到一种方法在我的应用程序中使用这些级别,以便我可以更好地读取日志。
默认情况下,如果我使用console.log()
打印到stdout
,日志将仅在按“任意日志级别”进行筛选时出现,并且我无法选择严重性级别。
我试图使用winston-gae
报告the docs,但没有任何成功。也许我配置错了?
更清楚,我想能够做这样的事情在Python(source):
import logging
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
logging.debug('This is a debug message')
logging.info('This is an info message')
logging.warning('This is a warning message')
logging.error('This is an error message')
logging.critical('This is a critical message')
self.response.out.write('Logging example.')
app = webapp2.WSGIApplication([
('/', MainPage)
], debug=True)
感谢您的回应。我会看看。 –