Mod aaa-12 集中消除log相关工程中的warning
RCA: SOL: 修改人:liangxia 检视人:
This commit is contained in:
parent
1d76282902
commit
7a22c7fc29
|
@ -4,6 +4,8 @@
|
||||||
#include "rpc_server.h"
|
#include "rpc_server.h"
|
||||||
#include "rpc_client.h"
|
#include "rpc_client.h"
|
||||||
|
|
||||||
|
int access(const char *pathname, int mode);
|
||||||
|
|
||||||
ret_code log_rpc_exec(char* service_name, char* method_name, pointer input, int input_len, int last_lenth)
|
ret_code log_rpc_exec(char* service_name, char* method_name, pointer input, int input_len, int last_lenth)
|
||||||
{
|
{
|
||||||
if ((input == NULL)
|
if ((input == NULL)
|
||||||
|
|
|
@ -147,7 +147,7 @@ ret_code log_remote_level_config_getall(uint source,
|
||||||
|
|
||||||
/* *.=emerg;*.=alert;*.=crit;*.=err;*.=warn;*.=notice;*.=info @1.1.1.1:514:RFC3164fmt
|
/* *.=emerg;*.=alert;*.=crit;*.=err;*.=warn;*.=notice;*.=info @1.1.1.1:514:RFC3164fmt
|
||||||
* *.=emerg;*.=alert;*.=crit;*.=err;*.=warn;*.=notice;*.=info @@1.1.1.2:514:RFC5424fmt */
|
* *.=emerg;*.=alert;*.=crit;*.=err;*.=warn;*.=notice;*.=info @@1.1.1.2:514:RFC5424fmt */
|
||||||
static ret_code cm_log_prase_host_from_str(const char *input_str, log_remote_host_x_t *ret_host)
|
static ret_code cm_log_prase_host_from_str(char *const input_str, log_remote_host_x_t *ret_host)
|
||||||
{
|
{
|
||||||
char *pos = NULL;
|
char *pos = NULL;
|
||||||
char *pos2 = NULL;
|
char *pos2 = NULL;
|
||||||
|
@ -336,7 +336,7 @@ static ret_code cm_log_get_host_from_file_by_addr(const char *file_str, const ch
|
||||||
while ((getline(&line, &n, fp)) != -1)
|
while ((getline(&line, &n, fp)) != -1)
|
||||||
{
|
{
|
||||||
memset(tmp_str, 0, sizeof(tmp_str));
|
memset(tmp_str, 0, sizeof(tmp_str));
|
||||||
snprintf(tmp_str, "@%s:", addr_str);
|
sprintf(tmp_str, "@%s:", addr_str);
|
||||||
if (NULL == strstr(line, tmp_str))
|
if (NULL == strstr(line, tmp_str))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -16,7 +16,7 @@ int conf_file(cJSON *json_obj, int argc, char **argv)
|
||||||
log_file_t log_file_out = {0};
|
log_file_t log_file_out = {0};
|
||||||
int level = LOG_INFO;
|
int level = LOG_INFO;
|
||||||
uint config_type = CM_CONFIG_SET;
|
uint config_type = CM_CONFIG_SET;
|
||||||
cJSON *json_output = NULL;
|
char *json_output = NULL;
|
||||||
|
|
||||||
log_file.is_compress = LOG_UNCOMPRESS;
|
log_file.is_compress = LOG_UNCOMPRESS;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ static log_rfc_t get_rfc_by_name(const char *name)
|
||||||
static int conf_remote_by_config_id(cJSON *json_obj, const char *host, const u16 port, const log_rfc_t rfc, uint64 config_id)
|
static int conf_remote_by_config_id(cJSON *json_obj, const char *host, const u16 port, const log_rfc_t rfc, uint64 config_id)
|
||||||
{
|
{
|
||||||
log_remote_host_x_t remote = {0};
|
log_remote_host_x_t remote = {0};
|
||||||
cJSON *json_output = NULL;
|
char *json_output = NULL;
|
||||||
int config_type = CM_CONFIG_SET;
|
int config_type = CM_CONFIG_SET;
|
||||||
|
|
||||||
if (LOG_CONFIG_REMOTE_GET_HOST == config_id)
|
if (LOG_CONFIG_REMOTE_GET_HOST == config_id)
|
||||||
|
@ -141,7 +141,7 @@ int conf_remote_level(cJSON *json_obj, int argc, char **argv)
|
||||||
log_remote_level_t log_level = {0};
|
log_remote_level_t log_level = {0};
|
||||||
log_remote_level_t log_level_out = {0};
|
log_remote_level_t log_level_out = {0};
|
||||||
uint config_type = CM_CONFIG_SET;
|
uint config_type = CM_CONFIG_SET;
|
||||||
cJSON *json_output = NULL;
|
char*json_output = NULL;
|
||||||
|
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
ULOG_WARNING(g_log, "Not input log level");
|
ULOG_WARNING(g_log, "Not input log level");
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int set_log_conf(uint config_type, cJSON *json_obj, uint64 config_id, cJSON **json_output)
|
int set_log_conf(uint config_type, cJSON *json_obj, uint64 config_id, char **json_output)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *output;
|
char *output;
|
||||||
|
@ -48,7 +48,7 @@ int set_log_conf(uint config_type, cJSON *json_obj, uint64 config_id, cJSON **js
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int logging_terminal_json_parse(pointer input, pointer config_buff, int conf_id)
|
int logging_terminal_json_parse(pointer input, pointer config_buff, uint64 conf_id)
|
||||||
{
|
{
|
||||||
cJSON *json_obj = NULL;
|
cJSON *json_obj = NULL;
|
||||||
|
|
||||||
|
|
|
@ -13,15 +13,15 @@
|
||||||
|
|
||||||
extern ulog_t *g_log;
|
extern ulog_t *g_log;
|
||||||
|
|
||||||
int set_log_conf(uint config_type, cJSON *json_obj, uint64 config_id, cJSON **json_output);
|
int set_log_conf(uint config_type, cJSON *json_obj, uint64 config_id, char **json_output);
|
||||||
int logging_terminal_json_parse(pointer input, pointer config_buff, int conf_id);
|
int logging_terminal_json_parse(pointer input, pointer config_buff, uint64 conf_id);
|
||||||
|
|
||||||
|
|
||||||
#define CONF_TERMINAL(type, config_type, json_obj, str_level, on, module_name, conf_id) { \
|
#define CONF_TERMINAL(type, config_type, json_obj, str_level, on, module_name, conf_id) { \
|
||||||
type terminal = {0}; \
|
type terminal = {0}; \
|
||||||
type terminal_out = {0}; \
|
type terminal_out = {0}; \
|
||||||
int level; \
|
int level; \
|
||||||
cJSON *json_output = NULL; \
|
char *json_output = NULL; \
|
||||||
\
|
\
|
||||||
if ((level = log_str_to_level(str_level)) < 0) { \
|
if ((level = log_str_to_level(str_level)) < 0) { \
|
||||||
ULOG_WARNING(g_log, "Unknown log level:%s", str_level); \
|
ULOG_WARNING(g_log, "Unknown log level:%s", str_level); \
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#define REDIRECT_SEPERATE " "
|
#define REDIRECT_SEPERATE " "
|
||||||
|
|
||||||
typedef int (*rpc_cb)(pointer *input, const void *arg, char *str_err, int str_len);
|
typedef int (*rpc_cb)(pointer input, const void *arg, char *str_err, int str_len);
|
||||||
|
|
||||||
extern ulog_t *g_log;
|
extern ulog_t *g_log;
|
||||||
extern FILE *g_conf_fp;
|
extern FILE *g_conf_fp;
|
||||||
|
|
|
@ -347,7 +347,7 @@ static int __rpc_conf_log_remote(pointer input, const void *arg, char *str_err,
|
||||||
log_op_t op;
|
log_op_t op;
|
||||||
memcpy(&op, arg, sizeof(op));
|
memcpy(&op, arg, sizeof(op));
|
||||||
|
|
||||||
int ret = config_log_remote_host(op, (const log_remote_level_t *)input);
|
int ret = config_log_remote_host(op, (const log_remote_host_t *)input);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
strncpy(str_err, "Configuring remote of log is faiure", str_len);
|
strncpy(str_err, "Configuring remote of log is faiure", str_len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "log_common.h"
|
#include "log_common.h"
|
||||||
#include "ulog_api.h"
|
#include "ulog_api.h"
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define SEV_TIMEOUT 1
|
#define SEV_TIMEOUT 1
|
||||||
#define SEV_CMD "systemctl restart rsyslog"
|
#define SEV_CMD "systemctl restart rsyslog"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue