chore(file plugin):update log level

This commit is contained in:
liyuxi
2023-05-19 05:44:58 +00:00
parent 3195e0dc83
commit fe065c8c40
2 changed files with 24 additions and 8 deletions
+21 -5
View File
@@ -76,6 +76,9 @@ static int driver_close(neu_plugin_t *plugin)
{
free(plugin);
plog_notice(plugin, "close and free `%s` plugin success",
plugin->common.name);
return 0;
}
@@ -83,13 +86,17 @@ static int driver_init(neu_plugin_t *plugin)
{
plugin->events = neu_event_new();
plog_notice(plugin, "initialize `%s` plugin success", plugin->common.name);
return 0;
}
static int driver_uninit(neu_plugin_t *plugin)
{
neu_event_close(plugin->events);
plog_info(plugin, "node; file uininit ok");
plog_notice(plugin, "uninitialize `%s` plugin success",
plugin->common.name);
return 0;
}
@@ -98,6 +105,8 @@ static int driver_start(neu_plugin_t *plugin)
{
plugin->common.link_state = NEU_NODE_LINK_STATE_CONNECTED;
plog_notice(plugin, "start `%s` plugin success", plugin->common.name);
return 0;
}
@@ -105,6 +114,8 @@ static int driver_stop(neu_plugin_t *plugin)
{
plugin->common.link_state = NEU_NODE_LINK_STATE_DISCONNECTED;
plog_notice(plugin, "stop `%s` plugin success", plugin->common.name);
return 0;
}
@@ -115,7 +126,7 @@ static int driver_config(neu_plugin_t *plugin, const char *config)
int ret = neu_parse_param((char *) config, &err_param, 1, &file_length);
if (ret != 0) {
plog_warn(plugin, "config:%s, decode error: %s", config, err_param);
plog_error(plugin, "config:%s, decode error: %s", config, err_param);
free(err_param);
return -1;
}
@@ -138,8 +149,8 @@ static int driver_request(neu_plugin_t *plugin, neu_reqresp_head_t *head,
static int driver_validate_tag(neu_plugin_t *plugin, neu_datatag_t *tag)
{
plog_debug(plugin, "validate tag success, name:%s, address:%s,type:%d ",
tag->name, tag->address, tag->type);
plog_notice(plugin, "validate tag success, name:%s, address:%s, type:%d ",
tag->name, tag->address, tag->type);
return 0;
}
@@ -152,5 +163,10 @@ static int driver_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group)
static int driver_write(neu_plugin_t *plugin, void *req, neu_datatag_t *tag,
neu_value_u value)
{
return file_write(plugin, req, tag, value);
int ret = file_write(plugin, req, tag, value);
plog_notice(plugin, "write response, ret: %d, tag_name: %s, type: %d", ret,
tag->name, tag->type);
return ret;
}
+3 -3
View File
@@ -62,7 +62,7 @@ int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group)
}
if ((f = fopen(tag->address, "rb+")) == NULL) {
nlog_error("open file:%s", tag->address);
nlog_warn("open file:%s", tag->address);
dvalue.type = NEU_TYPE_ERROR;
dvalue.value.i32 = NEU_ERR_FILE_OPEN_FAILURE;
goto dvalue_result;
@@ -81,7 +81,7 @@ int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group)
fseek(f, 0, SEEK_SET);
int ret = fread(buf, sizeof(char), length, f);
if (ret == 0) {
nlog_error("read file failed:%s", tag->address);
nlog_warn("read file failed:%s", tag->address);
dvalue.type = NEU_TYPE_ERROR;
dvalue.value.i32 = NEU_ERR_FILE_READ_FAILURE;
@@ -125,7 +125,7 @@ int file_write(neu_plugin_t *plugin, void *req, neu_datatag_t *tag,
int ret = 0;
if (0 == fwrite(value.str, sizeof(char), strlen(value.str), fp)) {
nlog_error("write file failed:%s", tag->address);
nlog_warn("write file failed:%s", tag->address);
ret = NEU_ERR_FILE_WRITE_FAILURE;
goto dvalue_result;
}