Structures

StrExtArgs_typ

Format arguments for a log message. This type comes from StringExt and is passed to the log functions by address through pMsgData. Each format specifier in the message consumes the next unused member of the matching type, in order.

Name Type Description
r ARRAY[0..4] OF REAL Values for %r and %f
s ARRAY[0..4] OF UDINT Addresses of strings for %s
b ARRAY[0..4] OF BOOL Values for %b
i ARRAY[0..4] OF DINT Values for %i and %d

Application variables are left undeclared in this snippet. The call is guarded on an edge flag because a log entry is a one-shot event, not something to write every scan.

void _CYCLIC ProgramCyclic(void)
{
	StrExtArgs_typ msgData;

	if (partCompleteEdge) {
		memset(&msgData, 0, sizeof(msgData));

		msgData.i[0] = partCount;
		msgData.s[0] = (UDINT)recipeName;

		logInfo("App", 1, "Produced %i parts on recipe %s", (UDINT)&msgData);
	}
}

A specifier past the fifth of its type is dropped from the rendered message without an error.

LOG_PERSISTENCE_enum

Where a logbook’s entries are stored. Selected when the logbook is created with createLogInit().

Name Value Description
LOG_PERSISTENCE_VOLATILE 0 Volatile (DRAM). Entries are lost on any restart.
LOG_PERSISTENCE_REMANENT 1 Remanent (USERRAM). Entries survive a warm restart.
LOG_PERSISTENCE_PERSIST 2 Persistent (USERROM). Entries survive a cold restart.

LOG_PERSISTENCE_PERSIST is the usual choice. Log entries earn their keep after a restart, which is exactly when a volatile logbook is already empty.

Note: For the remanent and persistent options, entries are held in a DRAM image that is copied to the backing memory every 60 seconds and on an orderly shutdown. Up to a minute of entries can be lost to a power fail or watchdog reset.

LOG_SEVERITY_enum

Severity of a log entry. The severity-specific functions select this internally; it is exposed for code that builds its own event IDs. Values align with the arEVENTLOG_SEVERITY_ constants.

Name Value Description
LOG_SEVERITY_SUCCESS 0 Success
LOG_SEVERITY_INFO 1 Informational
LOG_SEVERITY_WARNING 2 Warning
LOG_SEVERITY_ERROR 3 Error

Status

Every LogThat function returns a status. 0 means the operation succeeded.

Name Value Description
0 No error
LOG_ERR_INVALIDINPUT 58300 A required pointer was null, in practice the logger name. An empty name is not caught here: createLogInit fails downstream with arEVENTLOG_ERR_NAME_INVALID, and a write fails with arEVENTLOG_ERR_LOGBOOK_NOT_FOUND
LOG_ERR_NOTINITIALIZED 58301 Deprecated, no longer returned
LOG_ERR_LOGGERSFULL 58302 Deprecated, no longer returned

Any other non-zero value is passed straight through from the underlying ArEventLog function block that failed, so arEVENTLOG_ERR_ codes show up here. These are the ones that come up in practice:

Name Value Usually means
arEVENTLOG_ERR_LOGBOOK_EXISTS -1070586095 The logbook already exists. Expected for a persistent logbook on any restart, and for a remanent one on a warm restart. Not a failure.
arEVENTLOG_ERR_MODULE_EXISTS -1070586084 The name collides with a task, program, or other module on the target. No logbook is created.
arEVENTLOG_ERR_LOGBOOK_NOT_FOUND -1070586087 Writing to a logbook that was never created, or whose creation failed.
arEVENTLOG_ERR_NAME_INVALID -1070586093 The name is empty, too long, or starts with $.
arEVENTLOG_ERR_SIZE_INVALID -1070586092 The requested log data area is smaller than the 4096 byte minimum.
arEVENTLOG_ERR_PERSISTENCE_INVAL -1070586091 The persistence value is not one of the three valid options.
arEVENTLOG_ERR_INTERNAL -1070586094 Internal error, often not enough memory for a logbook of the requested size.

See the Automation Studio help for ArEventLog for the full list.

Note: Versions before 0.05.0 wrapped the BRSE_ARL library and could return its 58200-58203 codes. Those are no longer produced.

Constants

Name Type Value Description
LOG_STRLEN_LOGGERNAME UINT 8 Declared length of the logbook name inputs. Automation Runtime itself allows 10
LOG_STRLEN_MESSAGE UINT 320 Declared length of the message inputs, which hold 320 characters plus the terminating null. It is also the size of the C buffer LogThat formats into, so a formatted message is capped at 319 characters plus the null
LOG_STRLEN_STATENAME UINT 80 Maximum length of a state name in logStateChange
LOG_STRLEN_MODULENAME UINT 20 Maximum length of a module name in logStateChange
LOG_DEFAULT_LOGGERSIZE UDINT 100000 Log data area size used when createLogInit() is passed a size of 0
LOG_DEFAULT_FACILITY UINT 0 Facility used when building event IDs in the severity-specific functions

logLogger_typ

Legacy type from the ManageLoggers() interface that was removed in 0.05.0. It is still exported for compatibility with older code, but no LogThat function uses it.