InvocationContext class

Contains metadata and helper methods specific to this invocation

Constructors

InvocationContext(InvocationContextInit)

For testing purposes only. This will always be constructed for you when run in the context of the Azure Functions runtime

Properties

extraInputs

An object used to get secondary inputs

extraOutputs

An object used to set secondary outputs

functionName

The name of the function that is being invoked

invocationId

A unique guid specific to this invocation

options

The options used when registering the function NOTE: This value may differ slightly from the original because it has been validated and defaults may have been explicitly added

retryContext

The retry context of the current function execution if the retry policy is defined

traceContext

TraceContext information to enable distributed tracing scenarios

triggerMetadata

Metadata about the trigger or undefined if the metadata is already represented elsewhere For example, this will be undefined for http and timer triggers because you can find that information on the request & timer object instead

Methods

debug(any[])

The recommended way to log debug data (level 1) during invocation. Similar to Node.js's console.debug, but has integration with Azure features like application insights

error(any[])

The recommended way to log error data (level 4) during invocation. Similar to Node.js's console.error, but has integration with Azure features like application insights

info(any[])

The recommended way to log information data (level 2) during invocation. Similar to Node.js's console.info, but has integration with Azure features like application insights

log(any[])

The recommended way to log data during invocation. Similar to Node.js's console.log, but has integration with Azure features like application insights Uses the 'information' log level

trace(any[])

The recommended way to log trace data (level 0) during invocation. Similar to Node.js's console.trace, but has integration with Azure features like application insights

warn(any[])

The recommended way to log warning data (level 3) during invocation. Similar to Node.js's console.warn, but has integration with Azure features like application insights

Constructor Details

InvocationContext(InvocationContextInit)

For testing purposes only. This will always be constructed for you when run in the context of the Azure Functions runtime

new InvocationContext(init?: InvocationContextInit)

Parameters

Property Details

extraInputs

An object used to get secondary inputs

extraInputs: InvocationContextExtraInputs

Property Value

extraOutputs

An object used to set secondary outputs

extraOutputs: InvocationContextExtraOutputs

Property Value

functionName

The name of the function that is being invoked

functionName: string

Property Value

string

invocationId

A unique guid specific to this invocation

invocationId: string

Property Value

string

options

The options used when registering the function NOTE: This value may differ slightly from the original because it has been validated and defaults may have been explicitly added

options: EffectiveFunctionOptions

Property Value

retryContext

The retry context of the current function execution if the retry policy is defined

retryContext?: RetryContext

Property Value

traceContext

TraceContext information to enable distributed tracing scenarios

traceContext?: TraceContext

Property Value

triggerMetadata

Metadata about the trigger or undefined if the metadata is already represented elsewhere For example, this will be undefined for http and timer triggers because you can find that information on the request & timer object instead

triggerMetadata?: TriggerMetadata

Property Value

Method Details

debug(any[])

The recommended way to log debug data (level 1) during invocation. Similar to Node.js's console.debug, but has integration with Azure features like application insights

function debug(args: any[])

Parameters

args

any[]

error(any[])

The recommended way to log error data (level 4) during invocation. Similar to Node.js's console.error, but has integration with Azure features like application insights

function error(args: any[])

Parameters

args

any[]

info(any[])

The recommended way to log information data (level 2) during invocation. Similar to Node.js's console.info, but has integration with Azure features like application insights

function info(args: any[])

Parameters

args

any[]

log(any[])

The recommended way to log data during invocation. Similar to Node.js's console.log, but has integration with Azure features like application insights Uses the 'information' log level

function log(args: any[])

Parameters

args

any[]

trace(any[])

The recommended way to log trace data (level 0) during invocation. Similar to Node.js's console.trace, but has integration with Azure features like application insights

function trace(args: any[])

Parameters

args

any[]

warn(any[])

The recommended way to log warning data (level 3) during invocation. Similar to Node.js's console.warn, but has integration with Azure features like application insights

function warn(args: any[])

Parameters

args

any[]