context.log vs console.log in Azure function apps
You can redirect console.log to context.log with my npm package so you dont have to pass down the context everywhere.
https://www.npmjs.com/package/azure-function-log-intercept
Source here if you just want to create your own module
https://github.com/BrianRosamilia/azure-function-log-intercept/blob/master/index.js
This documentation should answer your question :)
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.
Long story short - context.log
is best!