.. _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: printf("Index(%d), ", pLogAlarm->_iIndex); printf("Param0: %s, ", pLogAlarm->_szParam[0]); printf("Param1: %s, ", pLogAlarm->_szParam[1]); printf("Param2: %s\n", pLogAlarm->_szParam[2]); break; default: break; } break; default: break; } } 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.