Function: Log Execution Context

by Simon Sparks · 4 February 2026

To use this function add it to the class library file named Utilities.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: Utilities.ts

Function: logExecutionContext

public static logExecutionContext(objLogger: Logger): void {

  let strActionName: string = arguments.callee.name.substring(6, arguments.callee.name.length);

  // let objWorkflowItemInfo: WorkflowItemInfo = System.currentWorkflowItem();

  // System.setLogMarker("SCRIPT: " + objWorkflowItemInfo.getDisplayName());

  let objExecutionContext: ExecutionContext = System.getContext();

  let arrParameterName: string[] = objExecutionContext.parameterNames();

  arrParameterName.forEach((strParameterName: string): void => {

    let anyParameterValue: any = objExecutionContext.getParameter(strParameterName);

    let strParameterType: string = System.getObjectType(anyParameterValue);

    if (strParameterType === "Properties") {
      let objResourceProperties: Properties = anyParameterValue as Properties;

      let arrKey: string[] = objResourceProperties.keys;

      arrKey.forEach((strKey: string): void => {

        if (strKey === "tags") {
          let objResourceProperties: Properties = objExecutionContext.getParameter("tags");

          let arrKey: string[] = objResourceProperties.keys;

          arrKey.forEach((strKey: string): void => {

            let anyValue: any = objResourceProperties.get(strKey);

            let strResourcePropertyType: string = System.getObjectType(anyValue);

            objLogger.info(`Resource Properties - Tags: ${strKey}:${strResourcePropertyType} = ${anyValue}`);

          });
        }
        else {
          let anyResourcePropertyValue: any = objResourceProperties.get(strKey);

          let strResourcePropertyType: string = System.getObjectType(anyResourcePropertyValue);

          objLogger.info(`Resource Properties: ${strKey}:${strResourcePropertyType} = ${objResourceProperties.get(strKey)}`);
        }

      });
    }
    else if (strParameterType === "Array") {
      let arr: [] = anyParameterValue as [];

    }
    else {
      objLogger.info(`Execution Context: Key - ${strParameterName} - Value - ${anyParameterValue as string}`);
    }
  });
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like