FB_BA_LogMessageItf

FB_BA_LogMessageItf 1:

The FB_BA_LogMessageItf function block provides an interface for structured logging of messages in the TwinCAT runtime. It combines assertion and show methods with various parameter variations to enable flexible error and message handling.

The function block internally manages a code hash to block repeated identical messages within short time periods, in order to protect the log file from being flooded. This suppression can be manually reset using the Reset() method.

FB_BA_LogMessageItf 2:

The function block requires implementation of the ISymbolPathPtr_interface in order to include the current symbol path in the log output. This helps with error identification and error handling.

FB_BA_LogMessageItf 3:

All messages can optionally be assigned a log code (_sLogCode_) to uniquely identify and categorize them.

Syntax

FUNCTION_BLOCK FB_BA_LogMessageItf
VAR_INPUT
  iSymPath : I_SymbolPathPtr;
END_VAR

FB_BA_LogMessageItf 4: Inputs

Name

Type

Description

iSymPath

I_SymbolPathPtr

Reference to the current instance of the symbol path function

FB_BA_LogMessageItf 5: Methods

Name

Definition location

Description

Assert

Local

Validates a condition and outputs an ERROR message (variants: Assert through Assert5).

Show

Local

Outputs a message via the ADS logging system (variants: Show through Show5).

Reset

Local

Resets the blocking logic so that the next message is output.