exos_log_handle_t: The log handle

<< 点击显示目录 >>

主页  exOS使用助手 > exOS Automation Help > Development > Programming > exOS Log API reference (exos_log.h) >

exos_log_handle_t: The log handle

typedef struct exos_log_handle exos_log_handle_t;
结构 exos_log_handle
{
char *name;
bool ready;
bool excluded;
bool console;
exos_config_change_cb config_change_cb;
void *config_change_user_context;
void *_reserved[6];
exos_log_private_t _private;
};

exos_log_handle_t用作 应用程序记录日志的通用引用。 虽然在记录日志时指定一个句柄可能并不常见(通常日志会直接转到 stdout),但句柄可以让应用程序跨系统发送日志信息,以便在一个中心点进行收集。此外,保留句柄还能让应用程序接收日志配置(过滤),使代码中的日志条目能快速返回,而不是用日志服务器进行过滤的日志信息来臃肿系统。这样,具有大量日志信息的应用程序就能在正常生产中有效运行,同时,如果用户/操作员需要查找应用程序中的问题,还能更密集地记录日志。

 

成员:

 

名称:只读的应用程序名称,通过 exos_log_init() 进行初始化

ready:只读。应用程序已收到配置并准备好记录

excluded:只读。应用程序已收到配置并被排除在外,这意味着它不会向日志服务器发送任何信息。

控制台:只读。应用程序在控制台(stdout)上输出所有日志信息(未过滤的信息)

config_change_cb:使用 exos_log_config_listener() 设置的更改回调

config_change_user_context:为 exos_config_change_cb() 回调 设置的用户上下文  。通过 exos_log_config_listener()设置。


 typedef struct exos_log_handle exos_log_handle_t;
 struct exos_log_handle
 {
      char *name;
      bool ready;
      bool excluded;
      bool console;
      exos_config_change_cb config_change_cb;
      void *config_change_user_context;
      void *_reserved[6];
      exos_log_private_t _private;
 };

The exos_log_handle_t is used as a general reference for logging from an application. Whereas it might be uncommon to have to specify a handle for logging something (normally logs would just go to the stdout), the handle enables the application to send log-messages across the systems to be collected at a central point. Additionally, keeping a handle allows the applications to receive log configuration (filter) that log entries in the code get a quick return instead of bloating the system with log messages that are then filtered on the log-server. It allows for applications with extensive log information to run effectively in normal production, but still be able to log more intensively if the user / operator needs to look for problems in the applications.

Members:

name: Read-only name of the application, initialized with exos_log_init()

ready: Read only. Application has received config and is ready to log

excluded: Read only. Application has received config and has been excluded, which means it will not send any messages to the log-server.

console: Read only. Application outputs all log-messages (that are not filtered) on the console (stdout)

config_change_cb: The change callback set with exos_log_config_listener()

config_change_user_context: The user context set for the exos_config_change_cb() callback. Set with exos_log_config_listener().