format log

This commit is contained in:
liuwentan
2023-03-02 14:52:31 +08:00
parent d790afa58b
commit 5a53edd943
27 changed files with 684 additions and 582 deletions

View File

@@ -60,7 +60,8 @@ void *fqdn_plugin_schema_new(cJSON *json, struct table_manager *tbl_mgr,
item = cJSON_GetObjectItem(json, "custom");
if (NULL == item || item->type != cJSON_Object) {
log_error(logger, MODULE_FQDN_PLUGIN,
"table %s has no custom column", table_name);
"[%s:%d] table %s has no custom column",
__FUNCTION__, __LINE__, table_name);
goto error;
}
@@ -142,7 +143,7 @@ int fqdn_plugin_table_set_ex_data_schema(void *fqdn_plugin_schema,
if (schema->ex_schema != NULL) {
assert(0);
log_error(logger, MODULE_FQDN_PLUGIN,
"Error: %s, EX data schema already registed", __FUNCTION__);
"[%s:%d], EX data schema already registed", __FUNCTION__, __LINE__);
return -1;
}
@@ -202,8 +203,8 @@ int fqdn_plugin_accept_tag_match(struct fqdn_plugin_schema *schema, const char *
&column_offset, &column_len);
if (ret < 0) {
log_error(logger, MODULE_FQDN_PLUGIN,
"fqdn_plugin table(table_id:%d) has no rule_tag, line:%s",
schema->table_id, line);
"[%s:%d] fqdn_plugin table(table_id:%d) has no rule_tag, line:%s",
__FUNCTION__, __LINE__, schema->table_id, line);
schema->update_err_cnt++;
return TAG_MATCH_ERR;
}
@@ -215,8 +216,8 @@ int fqdn_plugin_accept_tag_match(struct fqdn_plugin_schema *schema, const char *
FREE(tag_str);
if (TAG_MATCH_ERR == ret) {
log_error(logger, MODULE_FQDN_PLUGIN,
"fqdn_plugin table(table_id:%d) has invalid tag format, line:%s",
schema->table_id, line);
"[%s:%d] fqdn_plugin table(table_id:%d) has invalid tag format, line:%s",
__FUNCTION__, __LINE__, schema->table_id, line);
schema->update_err_cnt++;
return TAG_MATCH_ERR;
}
@@ -249,8 +250,8 @@ fqdn_plugin_rule_new(const char *line, struct fqdn_plugin_schema *schema,
ret = get_column_pos(line, schema->item_id_column, &column_offset, &column_len);
if (ret < 0) {
log_error(logger, MODULE_FQDN_PLUGIN,
"fqdn_plugin table(table_id:%d) line:%s has no item_id column",
schema->table_id, line);
"[%s:%d] fqdn_plugin table(table_id:%d) line:%s has no item_id column",
__FUNCTION__, __LINE__, schema->table_id, line);
goto error;
}
fqdn_plugin_rule->id = atoi(line + column_offset);
@@ -258,8 +259,8 @@ fqdn_plugin_rule_new(const char *line, struct fqdn_plugin_schema *schema,
ret = get_column_pos(line, schema->suffix_flag_column, &column_offset, &column_len);
if (ret < 0) {
log_error(logger, MODULE_FQDN_PLUGIN,
"fqdn_plugin table(table_id:%d) line:%s has no suffix_match_method column",
schema->table_id, line);
"[%s:%d] fqdn_plugin table(table_id:%d) line:%s has no suffix_match_method column",
__FUNCTION__, __LINE__, schema->table_id, line);
goto error;
}
fqdn_plugin_rule->is_suffix_match = atoi(line + column_offset);
@@ -267,8 +268,8 @@ fqdn_plugin_rule_new(const char *line, struct fqdn_plugin_schema *schema,
ret = get_column_pos(line, schema->fqdn_column, &column_offset, &column_len);
if (ret < 0) {
log_error(logger, MODULE_FQDN_PLUGIN,
"fqdn_plugin table(table_id:%d) line:%s has no fqdn column",
schema->table_id, line);
"[%s:%d] fqdn_plugin table(table_id:%d) line:%s has no fqdn column",
__FUNCTION__, __LINE__, schema->table_id, line);
goto error;
}
@@ -418,8 +419,8 @@ int fqdn_plugin_runtime_commit(void *fqdn_plugin_runtime, const char *table_name
new_fqdn_engine = FQDN_engine_new(rules, rule_cnt);
if (NULL == new_fqdn_engine) {
log_error(fqdn_plugin_rt->logger, MODULE_FQDN_PLUGIN,
"table[%s] rebuild FQDN engine failed when update %zu fqdn_plugin rules",
table_name, rule_cnt);
"[%s:%d] table[%s] rebuild FQDN engine failed when update %zu fqdn_plugin rules",
__FUNCTION__, __LINE__, table_name, rule_cnt);
ret = -1;
}
@@ -458,7 +459,7 @@ int fqdn_plugin_runtime_get_ex_data(void *fqdn_plugin_runtime, const char *query
if (NULL == fqdn_plugin_rt->engine) {
log_info(fqdn_plugin_rt->logger, MODULE_FQDN_PLUGIN,
"fqdn_engine is NULL, can't get ex data");
return 0;
return -1;
}
struct FQDN_match results[n_ex_data];