var result = writeToFile(filePath, myTextWithLineBreak,
"append", doSync);
if (result == true)
{
print("Writing into file was successful!");
}
else
{
print("Writing into file FAILED!");
}
The ring buffer alarm log data can be similarly retrieved as the contents of a file. There will
also be a vector returned which contains each alarm log entry. Additionally a format string and
a delimiter character can be provided to get a formatted result. The format string can contain
several keywords delimited by the delimiter character. The keywords that can be used are:
·
timestamp: The date and time when the alarm was logged in seconds since 1970-01-
01 00:00
·
timestring: The date and time when the alarm was logged as a formatted text. The
format is "DayOfWeek Month DayOfMonth Hour:Minute:Second Year", e.g. "Mon Sep 3
13:42:00 2012"
·
alarmtext: The text that was configured for the logged alarm in the property "Alarm Log
Text" of the alarm object.
·
alarmevent: The event that caused the alarm log entry (either "Enqueued", "Shown",
"Confirmed" or "Removed")
·
alarmvariables: The values of the variables @AlarmShow, @AlarmCurrent and
@AlarmCurrentPriority at the time of the logging entry. Each value in hex delimited by
the delimiter character.
Example format string: "timestring;alarmtext;alarmevent"
Delimiter character: ";"
This would cause one entry of the returned vector to look like this: "Mon Sep 3 13:42:00
2012;Engine Oil Pressure too high;Shown"
Prototype:
var result = getAlarmLogRingBufferContent(string formatString,
string delimiterCharacter);
Example:
//create a new array and retrieve the ring buffer content
var myLog = new Array();
myLog = getAlarmLogRingBufferContent ("timestring;alarmtext",
";");
//check if successful:
if (myLog.length == 0)
{
//reading failed! No entries in the buffer?
print("Error reading Alarm Log Ring Buffer content");
}
else
{