node.js - Azure 函数应用中的 context.log 与 console.log

标签 node.js azure azure-functions

在 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 using console.log are captured at the Function App level. This means that outputs from console.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/

相关文章:

c# - 从 Azure 获取用户的个人资料图片

Azure 计时器函数在触发器上运行多次

node.js - 有纯 node.js 的教程吗?

node.js - Nodejs 并行编程使用线程

java - topicJmsListenerContainerFactory 是否支持异步处理 - Azure Spring JMS?

debugging - 在 Azure 上进行开发时编辑并继续?

asp.net-core - Azure 函数 : host error has occurred during startup operation Could not load file

azure - 在 .Net Core Function Orchestrator 中调用 JavaScript Azure Function 作为事件函数

javascript - Node.js 安装向导在 Windows 7 32 位上过早结束

Javascript:错误:找不到模块 '../data/icons/table.png'