<< 点击显示目录 >> 主页 exOS使用助手 > exOS Automation Help > Development > Programming > exOS Log API reference (exos_log.h) > exos_log_change_config(): Change the current log configuration |
EXOS_ERROR_CODE exos_log_change_config(exos_log_handle_t *log, const exos_log_config_t *config);
该函数用于更改日志配置(日志服务器过滤器),即配置应发送哪些信息(级别/类型)。该日志配置将分发到系统中的所有日志应用程序。
新的日志配置通过 每个应用程序中 的exos_log_process() 函数 接收 。 如果应用程序正在监听配置更改事件,则会 触发 exos_config_change_cb。
例如
exos_log_handle_t log;
..
void changeToDebug()
{
exos_log_config_t config = {};
// 将配置更改为调试日志、
//但不包括所有系统信息和
//"SomeOtherApp_0 "应用程序
config.level = EXOS_LOG_LEVEL_DEBUG;
config.type.system = false;
config.type.user = true
config.type.verbose = true;
strcpy(config.excluded[0], "SomeOtherApp_0");
exos_log_change_config(&log, &config);
}
EXOS_ERROR_CODE exos_log_change_config(exos_log_handle_t *log, const exos_log_config_t *config);
This function changes the log configuration (log-server filters), i.e. configures which messages (level / type) that should be sent out. This log configuration is distributed to all logging applications across the system.
The new log configuration is recieved via the exos_log_process() function within each application. This triggers the exos_config_change_cb, in case the application is listening for configuration change events.
Example:
exos_log_handle_t log;
..
void changeToDebug()
{
exos_log_config_t config = {};
//change the configuration to debug logging,
//but exclude all system information and
//the 'SomeOtherApp_0' application
config.level = EXOS_LOG_LEVEL_DEBUG;
config.type.system = false;
config.type.user = true;
config.type.verbose = true;
strcpy(config.excluded[0], "SomeOtherApp_0");
exos_log_change_config(&log, &config);
}