在 Azure 函数应用的 nodejs 示例中,函数有一个传入的 context
对象,并且可以执行 context.log
的方式与使用 console.log
输出消息的方式相同。
这两种方法有什么区别,使用哪一种有什么关系吗?谢谢。
最佳答案
This documentation应该回答你的问题:)
In Functions, you use the
context.log
methods to write trace output to the console. In Functions v2.x, trace outputs usingconsole.log
are captured at the Function App level. This means that outputs fromconsole.log
are not tied to a specific function invocation, and hence aren't displayed in a specific function's logs. They do, however, propagate to Application Insights. In Functions v1.x, you cannot use console.log to write to the console.
长话短说 - context.log
是最好的!
关于node.js - Azure 函数应用中的 context.log 与 console.log,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54831728/