羊肉-动力工具-中件-日志-超时
A 类 中边 将记录超时错误消息的中间软件 刚才 函数实际时断时断.
主要特点:
- 记录错误日志消息
invocation timed out(以援引事件为属性)
开始
从国家预防机制安装: npm install @dazn/lambda-powertools-middleware-log-timeout
或者,如果使用模板的话 @dazn/lambda-powertools-pattern-basic 然后这个会被配置给你.
API 密码
中间软件接受可选的构造器参数 thresholdMillis,这是在引用被超时之前的 millis 数,即错误信息已被记录. thresholdMillis 默认为 10分钟。 。 。 .
const middy = require('middy')
const logTimeout = require('@dazn/lambda-powertools-middleware-log-timeout')
const handler = async (event, context) => {
return 42
}
module.exports = middy(handler)
// or .use(logTimeout(50)) to log the timeout error message 50ms before invocation times out
.use(logTimeout()) // defaults to 10ms
}
这是 建议 您使用 @dazn/lambda-powertools-pattern-basic 与其他有用的中间软件一起配置此中间软件.