.. _set_on_log_alarm: set_on_log_alarm ------------------------------------------ This function registers a callback that automatically monitors and processes **alarm** and **log information** generated by the robot controller. It is particularly useful for implementing event-driven responses to system warnings, errors, or informational messages. **Definition** |br| ``DRFLEx.h`` within class `CDRFLEx`, public section (line 637) .. code-block:: cpp void set_on_log_alarm(TOnLogAlarmCB pCallbackFunc) { _set_on_log_alarm(_rbtCtrl, pCallbackFunc); }; **Parameter** .. list-table:: :widths: 20 20 20 40 :header-rows: 1 * - **Parameter Name** - **Data Type** - **Default Value** - **Description** * - pCallbackFunc - :ref:`TOnLogAlarmCB ` - - - Callback function pointer triggered when an alarm or log is generated by the controller. **Return** |br| None **Example** .. code-block:: cpp void OnLogAlarmCB(LPLOG_ALARM pLogAlarm) { switch(pLogAlarm->_iGroup) { case LOG_GROUP_SYSTEMFRMK: switch(pLogAlarm->_iLevel) { case LOG_LEVEL_SYSINFO: cout << "Index(" << pLogAlarm->_iIndex << "), "; cout << "Param0: " << pLogAlarm->_szParam[0] << ", "; cout << "Param1: " << pLogAlarm->_szParam[1] << ", "; cout << "Param2: " << pLogAlarm->_szParam[2] << endl; break; default: break; } break; default: break; } } int main() { drfl.set_on_log_alarm(OnLogAlarmCB); } When this function is registered, the callback `OnLogAlarmCB()` is automatically invoked whenever an alarm or system log occurs in the controller. It prints the alarm **index** and **parameters** to the console, allowing developers to track detailed event information for debugging or monitoring purposes.