Log APIs

The script task in process model allows to add custom script including APIs which allows to insert customs logs. You can use the Log APIs in server script that you add in Script Task an any other task which has On Before or On After options in a process model.

Following Log APIs are currently available with ASG-Studio:

Insert INFO Log

This API when executed adds log message in the script task with log level INFO.

Syntax: log.info(message)

Parameters:

  • message: (String) Text that you want to insert in logs.

Example:

log.info("Loan value is calculated");

Insert INFO Log with Dynamic Variable Objects

This API when executed adds log message with dynamic variable objects in the script task with log level INFO.

Syntax: log.info(message, objects)

Parameters:

  • message: (String) Text that you want to insert in logs.
  • objects: (Objects) The variable objects to add to the message.

Example:

var loanValue= 4 + 20;

log.info("The calculated loan value is - {}" , loanValue);

Insert DEBUG Log

This API when executed adds log message in the script task with log level DEBUG.

Syntax: log.debug(message)

Parameters:

  • message: (String) Text that you want to insert in logs.

Example:

log.debug("Loan value is calculated");

Insert DEBUG Log with Dynamic Variable Objects

This API when executed adds log message with dynamic variable objects in the script task with log level DEBUG.

Syntax: log.debug(message, objects)

Parameters:

  • message: (String) Text that you want to insert in logs.
  • objects: (Objects) The variable objects to add to the message.

Example:

var loanValue= 4 + 20;

log.debug("The calculated loan value is - {}" , loanValue);

Insert WARN Log

This API when executed adds log message in the script task with log level WARN.

Syntax: log.warn(message)

Parameters:

  • message: (String) Text that you want to insert in logs.

Example:

log.warn("The value is greater than expected");

Insert WARN Log with Dynamic Variable Objects

This API when executed adds log message with dynamic variable objects in the script task with log level WARN.

Syntax: log.warn(message, objects)

Parameters:

  • message: (String) Text that you want to insert in logs.
  • objects: (Objects) The variable objects to add to the message.

Example:

var loanValue= 4 + 20;

log.warn("The value is greater than expected. The value is - {} ", loanValue);

Insert ERROR Log

This API when executed adds log message in the script task with log level ERROR.

Syntax: log.error(message)

Parameters:

  • message: (String) Text that you want to insert in logs.

Example:

log.error("Error in Loan value calculation");

Insert ERROR Log with Dynamic Variable Objects

This API when executed adds log message with dynamic variable objects in the script task with log level ERROR.

Syntax: log.error(message , objects)

Parameters:

  • message: (String) Text that you want to insert in logs.
  • objects: (Objects) The variable objects to add to the message.

Example:

var loanValue= 4 + 20;

log.error("Error in Loan value calculation. Exception - {}" , exception);