EXOS_ASSERT_OK

<< 点击显示目录 >>

主页  exOS使用助手 > exOS Automation Help > Development > Programming > Logging >

EXOS_ASSERT_OK

很多示例代码都使用了EXOS_ASSERT_OK宏。使用exos_log功能后,这个宏需要额外的EXOS_ASSERT_LOG定义,指出对 exos_log_handle_t 的引用 。

 

#define EXOS_ASSERT_LOG &logger  //needs to be defined before including exos_log.h
#include "exos_log.h"
exos_log_handle_t logger;
int main(void)
{
    ...
   exos_log_init(&logger, "MyApplication");
   ...
   while(true)
   {
       EXOS_ASSERT_OK(exos_dataset_init(...)); //using the &logger handle to print out errors / send out error messages
       ...
       exos_log_process(&log);
       ...
   }
}


A lot of example code is using the EXOS_ASSERT_OK macro. With the exos_log functionality, this macro needs an additional EXOS_ASSERT_LOG define, pointing out the reference to the exos_log_handle_t.

#define EXOS_ASSERT_LOG &logger  //needs to be defined before including exos_log.h
#include "exos_log.h"
exos_log_handle_t logger;
int main(void)
{
     ...
    exos_log_init(&logger, "MyApplication");
    ...
    while(true)
    {
        EXOS_ASSERT_OK(exos_dataset_init(...)); //using the &logger handle to print out errors / send out error messages
        ...
        exos_log_process(&log);
        ...
    }
}