<< 点击显示目录 >> 主页 exOS使用助手 > exOS Automation Help > Development > Programming > exOS Log API reference (exos_log.h) > exos_log_config_t: Log configuration structure |
typedef struct exos_log_config_type exos_log_config_type_t;
typedef struct exos_log_config exos_log_config_t;
struct exos_log_config_type
{
exos_bool user;
exos_bool system;
exos_bool verbose;
};
struct exos_log_config
{
EXOS_LOG_LEVEL level;
exos_log_config_type_t 类型;
exos_bool console;
exos_string exclude[EXOS_LOG_EXCLUDE_LIST_LEN][EXOS_LOG_MAX_NAME_LENGTH + 1];
};
exos_log_config_t 结构包含可在运行时为日志记录器系统设置的配置选项(过滤器) 。 通过 exos_log_change_config(),该日志配置会广播到系统中的所有模块/应用程序(即 通过 exos_log_process() 函数在每个 exos_log_handle_t中接收 )。
初始配置通过 AS 中的 exostarget 配置元素进行设置 ,并在启动数据通信服务(exos-api)前通过 exos-api.conf 自动传输到 Linux。 exostarget 中唯一缺少的配置选项 是 排除 列表,它定义了一个排除模块列表。 该 列表需要通过 exos_log_change_config()进行 设置 。
•级别:过滤级别,应适用于系统的其他部分,例如 将级别设置 为 EXOS_LOG_LEVEL_ERROR, 将禁止所有模块记录除错误以外的任何内容。
•类型
o用户:允许记录 设置了EXOS_LOG_TYPE_USER 位的信息
osystem:允许 记录设置了EXOS_LOG_TYPE_SYSTEM 位的信息
overbose:允许 记录设置了EXOS_LOG_TYPE_VERBOSE位的报文 。如果该标志与 EXOS_LOG_LEVEL_DEBUG 级别一起设置 ,则意味着基本上所有进来的信息都会被记录,具体取决于是否同时设置了用户或系统标志
•控制台:在向日志服务器发送日志信息的同时,启用应用程序在控制台(stdout)上记录信息。
只有通过当前过滤器(类型/级别)的日志信息才会在控制台上输出。
•排除:这里可以禁止某些模块向日志记录器输出信息。您可以通过输入模块名称来设置此排除项,以防止模块发送日志信息,而与当前过滤器无关。例如,您可能希望从 exos_msg 中获得详细信息,但不希望从 API 中获得。在这种情况下 , 如果 传递给 exos_log_init() 函数的名称 是 "MyApplication", 则 应设置 config.exclude[n] = "api_ MyApplication"。
typedef struct exos_log_config_type exos_log_config_type_t;
typedef struct exos_log_config exos_log_config_t;
struct exos_log_config_type
{
exos_bool user;
exos_bool system;
exos_bool verbose;
};
struct exos_log_config
{
EXOS_LOG_LEVEL level;
exos_log_config_type_t type;
exos_bool console;
exos_string exclude[EXOS_LOG_EXCLUDE_LIST_LEN][EXOS_LOG_MAX_NAME_LENGTH + 1];
};
The exos_log_config_t structure contains the configuration options (filters) that can be set for the logger system during runtime. With the exos_log_change_config(), this log configuration is broadcast to all modules/applications in the system (i.e. received at every exos_log_handle_t via the exos_log_process() function).
The initial configuration is set via the exostarget Configuration Element in Automation Studio, and is automatically transferred to Linux via the exos-api.conf before starting the data communication services (exos-api). The only missing configuration option in the exostarget is the exclude list, which defines a list of excluded modules. This list needs to be set via exos_log_change_config().
•level: Filtering level that should apply to the rest of the system, for example setting the level to EXOS_LOG_LEVEL_ERROR will inhibit all modules to log anything else but errors.
•type:
ouser: Allow the logging of messages with the EXOS_LOG_TYPE_USER bit set
osystem: Allow the logging of messages with the EXOS_LOG_TYPE_SYSTEM bit set
overbose: Allow the logging of messages with the EXOS_LOG_TYPE_VERBOSE bit set. If this flag is set together with the level EXOS_LOG_LEVEL_DEBUG, this means that you are logging basically anything coming in, depending if you have set the user or system flags as well
•console: Enable applications to log messages on the console (stdout) in parallel to sending the log messages to the log server.
Only log messages that pass the current filter (type/level) will be output on the console.
•exclude: Here, you are able to disable some of the modules to output something to the logger. You set this exclusion by entering the name of the modules you want to prevent sending out log messages, regardless of the current filter. For example, you might want detailed information from exos_msg, but not from the API. In this case you would set config.exclude[n] = "api_MyApplication" if the name passed to the exos_log_init() function was "MyApplication".