如何使用圣杯打印完整的 http 请求?

How to print complete http request using chalice?

我有一个小应用程序,我在其中使用圣杯来公开一些端点。出于记录目的,我想在调用任何处理程序函数时打印整个 url。

@app.route('/XYZ', methods=['GET'])
@logging_and_error_handling()
def get_XYZ_value():

例如,如果调用上述函数,我想使用 app.log.info() 记录整个 url。 类似于 call to http://myhostname.com/api/XYZ started

我尝试使用 app.current_request.to_dict(),但它似乎没有该信息。 Git reference.

是否有其他方法可以实现此目的?

我使用 app.current_request.context['resourcePath'] 作为 URL 并且还记录了以下内容:

  • app.current_request.method
  • app.current_request.uri_params
  • app.current_request.query_params
  • app.current_request.context.get('requestId')