<< 点击显示目录 >> 主页 exOS使用助手 > exOS Automation Help > Development > Programming > exOS Log API reference (exos_log.h) > exos_log_init(): Initialize the log handle |
EXOS_ERROR_CODE exos_log_init(exos_log_handle_t *log, const char *name);
每个应用程序都有一个长达 35 个字符的名称,该名称最好在系统内是唯一的,以便于识别特定日志信息的来源。 当然,用户也可以为 AR 和 Linux 应用程序选择相同的名称,因为在 AR 日志记录器中, Facility会 判断日志信息是来自 AR(0) 还是 Linux(1)。
在其他函数中使用日志句柄之前,需要调用该函数。退出应用程序时,或当应用程序决定停止日志记录时,应调用 exos_log_delete()函数 来释放所有已使用的资源。
•log:指向 正在初始化的exos_log_handle_t的指针
•name:字符串,定义发送日志信息的应用程序的(唯一)名称
使用示例
exos_log_handle_t logger;
int main()
{
exos_log_init(&logger, "MyApplication");
//start using the logger handle from here..
..
}
EXOS_ERROR_CODE exos_log_init(exos_log_handle_t *log, const char *name);
Every application has a 35 character long name that should preferrably be unique within the system to easier identify where the specific log message originated from. The user can of course choose to have the same name for an AR and Linux application that belong together, as in the AR logger, the Facility determines if the log message came from AR(0) or Linux(1).
This function needs to be called before using the log handle with any other function. When exiting the application, or when the application decides it's time to stop logging - you should call the exos_log_delete() to free up all used resources.
•log: pointer to the exos_log_handle_t that is being initialized
•name: string that defines the (unique) name of the application sending out log messages
Example usage:
exos_log_handle_t logger;
int main()
{
exos_log_init(&logger, "MyApplication");
//start using the logger handle from here..
..
}