You can now use Microsoft Azure 3.x logging functions in your extensibility action script.
Extensibility actions in Cloud Assembly now use the Microsoft Azure 3.x Scripting API which replaces the previous 1.x version. Microsoft Azure 3.x Scripting API is Linux-based and runs in a container environment.
Because of this version change, logging functions inserted into the script of extensibility actions that use Microsoft Azure as a FaaS (Function as a Service) provider work differently. The next two script samples demonstrate the different logging functions used in the two API versions.
Microsoft Azure 1.x script sample.
def handler(context, inputs): greeting = "Hello, {0}!".format(inputs["target"]) print(greeting) outputs = { "greeting": greeting } return outputs
Microsoft Azure 3.x script sample.
import logging def handler(context, inputs): greeting = "Hello, {0}!".format(inputs["target"]) logging.info(greeting) outputs = { "greeting": greeting } return outputs
The preceding sample demonstrates that the 3.x version adds the import logging
function at the beginning of the script while replacing the print()
function with the logging.info()
function. To continue using logging with extensibility actions created in the Microsoft Azure 1.x API, you must change the logging functions in your script so it matches the Microsoft Azure 3.x sample.
For more information on logging, see the Azure Functions Python developer guide.