LogAdd2 (FUN)

FUNCTION LogAdd2 : RTS_IEC_RESULT

<SIL2/> Add a new log entry to the log buffer.

If the buffer is full when this function is called, the oldest log entry in the buffer will be overwritten.

InOut:

Scope

Name

Type

Comment

Return

LogAdd2

RTS_IEC_RESULT

Returns the runtime system error code (see CmpErrors.library)

Input

hLogger

RTS_IEC_HANDLE

Handle to the logger which was retrieved by LogCreate() or LogOpen(). Use LogConstant.LOG_STD_LOGGER as a pseudo handle to add this log entry to the standard plc logger.

udiCmpID

UDINT

ComponentID. This ID consists of the VendorID (as HiWORD), the Library ID (as LoWORD) and in the LoWORD the bit to mark, that this is an IEC library. Example:

VendorID OR ComponentID.CMPID_IecCode OR libraryId

  • ComponentID.CMPID_IecCode: see Component Manager library

  • the VendorID can be 0xFFFF if unknown

  • the LibraryID must be unique for each vendor

NOTE: That the correct component name is displayed in the logger, you have to register your ComponentID first at the component manager:

hCmp := CMAddComponent(sCmpName, udiCmpId, udiCmpVersion, ADR(Result));

You have to remove the handle if your library is unloaded in the runtime system (e.g. in FB_Exit() method):

CMRemoveComponent(hCmp);

udiClassID

UDINT

ClassID of the logger. See LogClass.

udiErrorID

UDINT

ErrorID of the log entry. See CmpErrors.library.

udiInfoID

UDINT

ID of the info text to enable multiple language error texts

pszInfo

STRING

Logger text which is displayed in the logger