pangu http编译通过。
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "pangu_logger.h"
|
||||
#include <tfe_utils.h>
|
||||
#include <cjson/cJSON.h>
|
||||
#include "pangu_logger.h"
|
||||
#include <librdkafka/rdkafka.h>
|
||||
|
||||
#include <MESA/MESA_handle_logger.h>
|
||||
#include <MESA/MESA_prof_load.h>
|
||||
@@ -10,8 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
struct json_spec
|
||||
{
|
||||
@@ -101,7 +101,7 @@ static rd_kafka_t * create_kafka_handle(const char* brokerlist)
|
||||
|
||||
|
||||
|
||||
struct pangu_logger* pangu_send_log_init(const char* profile, const char* section, void* logger)
|
||||
struct pangu_logger* pangu_log_handle_create(const char* profile, const char* section, void* local_logger)
|
||||
{
|
||||
int ret=-1,i=0;
|
||||
char addr_string[TFE_SYMBOL_MAX]={0},local_msg_dir[TFE_STRING_MAX]={0};
|
||||
@@ -109,7 +109,7 @@ struct pangu_logger* pangu_send_log_init(const char* profile, const char* secti
|
||||
unsigned int ip_buff[TFE_SYMBOL_MAX];
|
||||
|
||||
struct pangu_logger* instance=ALLOC(struct pangu_logger,1);
|
||||
instance->global_logger=logger;
|
||||
instance->global_logger=local_logger;
|
||||
|
||||
instance->opt2json[LOG_OPT_HTTP_C2S_ISN] = {cJSON_Number,"isn"};
|
||||
instance->opt2json[LOG_OPT_HTTP_PROXY_FLAG] = {cJSON_Number,"proxy_flag"};
|
||||
@@ -123,13 +123,13 @@ struct pangu_logger* pangu_send_log_init(const char* profile, const char* secti
|
||||
instance->opt2json[LOG_OPT_HTTP_CONTENT_TYPE] = {cJSON_String,"content_type"};
|
||||
instance->opt2json[LOG_OPT_HTTP_CONTENT_LEN] = {cJSON_String,"content_len"};
|
||||
|
||||
TFE_LOG_ERROR(logger,"Pangu log is inititating from %s section %s.", profile, section);
|
||||
TFE_LOG_ERROR(local_logger,"Pangu log is inititating from %s section %s.", profile, section);
|
||||
|
||||
MESA_load_profile_string_def(profile, section, "NIC_NAME",nic_name,sizeof(nic_name),"eth0");
|
||||
instance->local_ip_nr=get_ip_by_eth_name(nic_name);
|
||||
if(instance->local_ip_nr==INADDR_NONE)
|
||||
{
|
||||
TFE_LOG_ERROR(logger, "%s get NIC_NAME: %s error.", __FUNCTION__, nic_name);
|
||||
TFE_LOG_ERROR(local_logger, "%s get NIC_NAME: %s error.", __FUNCTION__, nic_name);
|
||||
goto error_out;
|
||||
}
|
||||
inet_ntop(AF_INET,&(instance->local_ip_nr),instance->local_ip_str,sizeof(instance->local_ip_str));
|
||||
@@ -139,13 +139,13 @@ struct pangu_logger* pangu_send_log_init(const char* profile, const char* secti
|
||||
ret=MESA_load_profile_string_def(profile, section,"KAFKA_BROKERLIST", instance->brokerlist, sizeof(instance->brokerlist), NULL);
|
||||
if(ret<0)
|
||||
{
|
||||
TFE_LOG_ERROR(logger,"Pangu log init failed, no brokerlist in profile %s section %s.", profile, section);
|
||||
TFE_LOG_ERROR(local_logger,"Pangu log init failed, no brokerlist in profile %s section %s.", profile, section);
|
||||
goto error_out;
|
||||
}
|
||||
instance->kafka_handle=create_kafka_handle(instance->brokerlist);
|
||||
if(instance->kafka_handle==NULL)
|
||||
{
|
||||
TFE_LOG_ERROR(logger,"Pangu log init failed. Cannot create lafka handle with brokerlist: %s.", instance->brokerlist);
|
||||
TFE_LOG_ERROR(local_logger,"Pangu log init failed. Cannot create lafka handle with brokerlist: %s.", instance->brokerlist);
|
||||
goto error_out;
|
||||
}
|
||||
instance->topic_name="PXY_HTTP_LOG";
|
||||
|
||||
Reference in New Issue
Block a user