<< 点击显示目录 >> 主页 exOS使用助手 > exOS Automation Help > Development > Programming > Logging > Implementation |
•作为一种通信机制,每个系统上都有两个 ZMQ 队列,用于发送和接收日志数据和配置。这样,每个模块也能接收到系统日志服务器广播的配置(日志级别......)。
•基于上述原因,每个模块都应具有一个 init 函数
EXOS_ERROR_CODE exos_log_init(exos_log_handle_t *log, const char *module_name);
▪此外,为了接收配置(并激活本地日志记录器),还需要一个循环接收函数
EXOS_ERROR_CODE exos_log_process(const exos_log_handle_t *log);
▪要按一定的严重性级别记录日志,每个级别都有记录日志的功能
EXOS_ERROR_CODE exos_log_error(const exos_log_handle_t *log, char *format, ...);
EXOS_ERROR_CODE exos_log_success(const exos_log_handle_t *log, EXOS_LOG_TYPE type, char *format, ...);
EXOS_ERROR_CODE exos_log_info(const exos_log_handle_t *log, EXOS_LOG_TYPE type, char *format, ...);
EXOS_ERROR_CODE exos_log_debug(const exos_log_handle_t *log, EXOS_LOG_TYPE type, char *format, ...);
•As a communication mechanism, there are two ZMQ queues on each system that send and receive logdata and configuration. With this, each module is also able to receive this configuration (log-level...) which is broadcast by the log-server on the system.
•For the reasons mentioned above, each module should have an init function
EXOS_ERROR_CODE exos_log_init(exos_log_handle_t *log, const char *module_name);
•Furthermore, in order to receive configuration (and activate the local logger), you need a cyclic receive function
EXOS_ERROR_CODE exos_log_process(const exos_log_handle_t *log);
•To log at a certain severity level, there are functions on each level for logging
EXOS_ERROR_CODE exos_log_error(const exos_log_handle_t *log, char *format, ...);
EXOS_ERROR_CODE exos_log_success(const exos_log_handle_t *log, EXOS_LOG_TYPE type, char *format, ...);
EXOS_ERROR_CODE exos_log_info(const exos_log_handle_t *log, EXOS_LOG_TYPE type, char *format, ...);
EXOS_ERROR_CODE exos_log_debug(const exos_log_handle_t *log, EXOS_LOG_TYPE type, char *format, ...);