Log Statuses

The current status of a log channel can be obtained with the GetLogStatus or GetDetailLogStatus function.

The GetLogStatus function returns statuses in the LogStatus struct.

The GetDetailLogStatus function returns statuses in the DetailLogStatus struct. This struct contains all of the statuses in the LogStatus struct and a few other statuses.

The following table lists the statuses in the LogStatus struct.

Status

Description

bufferOpened

Whether the log channel has opened buffer memory for use in log collection. This status will be TRUE if buffer memory has been opened and FALSE otherwise.

Buffer memory is opened when the SetLog function is called. The size of the buffer memory depends on the arguments to the SetLog function and how many times this function is called.

The buffer memory is automatically closed (and this status will become FALSE) after log collection ends. After calling the StartLog function, log collection will end when the specified time elapses or the StopLog function is called.

This status is equal to the buffer.opened status in DetailLogStatus.

Also see Memory Usage.

logState

The state of the log channel.

The state is represented by the LogState enumerator.

The corresponding state for each DetailLogState returned by DetailLogStatus is as follows.

DetailLogState

Corresponding LogState

Idle

Idle

WaitingForTrigger

Running

Running

Running

Pause

Idle

Stop

Idle

WriteFail

WriteFail

BufferOverflow

BufferOverflow

Finished

Finished

samplesToCollect

The total number of samples to be collected during the logging operation. Each sample is equivalent to one line in the log file.

This status is equal to the buffer.samplesToCollect status in DetailLogStatus.

samplesCollected

The number of samples that have been collected in the logging operation.

This status is equal to the buffer.samplesCollected status in DetailLogStatus.

samplesWritten

The number of samples written to the log file in the logging operation. When the logging operation finishes without any errors, this status is equal to samplesCollected.

This status is equal to the samplesWritten status in DetailLogStatus.

millisecondsToCollect

The total amount of time to collect samples during the logging operation, in milliseconds.

This status is equal to the buffer.millisecondsToCollect status in DetailLogStatus.

millisecondsCollected

The amount of time that samples have been collected in the logging operation, in milliseconds.

This status is equal to the buffer.millisecondsCollected status in DetailLogStatus.

millisecondsWritten

The amount of time that samples have been written to the log file in the logging operation, in milliseconds. When the logging operation finishes without any errors, this status is equal to millisecondsCollected.

This status is equal to the millisecondsWritten status in DetailLogStatus.

The following table lists the statuses in the DetailLogStatus struct.

Status

Description

state

The state of the log channel.

The state is represented by the DetailLogState enumerator.

Information about each state is listed in the following table.

DetailLogState

Description

Idle

The log channel is not currently logging data.

When the engine is started, all log channels will be in this state.

The ResetLog function can be called while the state is Finished, WriteFail, or BufferOverflow to reset the log channel to this state.

WaitingForTrigger

The log channel is waiting for the trigger condition to start the log operation to be satisfied.

The log channel will change to this state if the StartLog function is called while using Log Triggers. The log channel will change to the Running state when the trigger condition is satisfied.

Running

The log channel is currently logging data.

The log channel will be collecting log data and writing the log data to file in this state.

Pause

The log channel is paused.

The log channel will change to this state if communication is stopped (with the StopCommunication function or due to an alarm) while in the Running state. The state will change back to Running when communication is started again.

Stop

The log channel is stopped but not finished.

The log channel will change from the Running state to this state if the StopLog function is called or the specified samplingTimeMilliseconds elapses.

After the log channel finishes writing the log data to file, it will change to the Finished state.

WriteFail

The log channel stopped logging because of a write failure.

A write failure occurs if the process is unable to write the log data to the specified file. This can occur if another process has opened the file for writing at the same time. For example, this error occurs if multiple log channels attempt to write to the same log file at the same time.

BufferOverflow

The log channel stopped logging because of a buffer overflow.

A buffer overflow occurs if the log data cannot be written to file as fast as it is collected.

Finished

The log channel finished logging data.

When the log channel is in this state, it has successfully finished writing all the log data to file. Another log operation can be started from this state.

buffer.opened

Whether the log channel has opened buffer memory for use in log collection. This status will be TRUE if buffer memory has been opened and FALSE otherwise.

Buffer memory is opened when the SetLog function is called. The size of the buffer memory depends on the arguments to the SetLog function and how many times this function is called.

The buffer memory is automatically closed (and this status will become FALSE) after log collection ends. After calling the StartLog function, log collection will end when the specified time elapses or the StopLog function is called.

Also see Memory Usage.

buffer.samplesToCollect

The total number of samples to be collected during the logging operation. Each sample is equivalent to one line in the log file.

When the state is Idle, this status is 0.

When the state is Finished, this status is equal to buffer.samplesCollected.

In any other state, this status is calculated from the samplingTimeMilliseconds and samplingPeriodInCycles specified to the SetLogOption function and the Cycle Time.

buffer.samplesCollected

The number of samples that have been collected in the logging operation.

buffer.millisecondsToCollect

The total amount of time to collect samples during the logging operation, in milliseconds.

When the state is Idle, this status is 0.

When the state is Finished, this status is equal to buffer.millisecondsCollected.

In any other state, this status is equal to the samplingTimeMilliseconds specified to the SetLogOption function.

buffer.millisecondsCollected

The amount of time that samples have been collected in the logging operation, in milliseconds.

interruptPeriod

The period of the interrupt (cyclic handler) that processes this log channel, in milliseconds.

This interrupt period is used to convert between sample units and millisecond units.

Also see Function Calls Affected by Interrupts.

logFileCount

The file number of the log file that is written by the log operation, starting at 0 for the first file.

This status will be 0 unless the maxLogFileSize option is set to a nonzero value. If this option is set, this status will be N-1 while writing to the N-th file. If the maxLogFileCount is set to a nonzero value and the isRotateFile is set to TRUE, this status will loop back to 0 when overwriting the first file.

samplesWrittenSize

The total number of bytes in the strings written to the log file during the logging operation.

samplesWritten

The number of samples written to the log file in the logging operation. When the logging operation finishes without any errors, this status is equal to buffer.samplesCollected.

millisecondsWritten

The amount of time that samples have been written to the log file in the logging operation, in milliseconds. When the logging operation finishes without any errors, this status is equal to buffer.millisecondsCollected.