TSG-8230 PacketAdapter支持输出json格式的日志,并支持动态调整日志级别
This commit is contained in:
@@ -27,7 +27,7 @@ extern "C"
|
||||
} gtp_info_t;
|
||||
|
||||
int decode_gtp(gtp_info_t *packet, const uint8_t *data, uint32_t len);
|
||||
void dump_gtp_info(uint32_t pkt_id, gtp_info_t *packet);
|
||||
int dump_gtp_info(gtp_info_t *packet, char *buff, size_t size);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ extern "C"
|
||||
} ipv4_info_t;
|
||||
|
||||
int decode_ipv4(ipv4_info_t *packet, const uint8_t *data, uint32_t len);
|
||||
void dump_ipv4_info(uint32_t pkt_id, ipv4_info_t *packet);
|
||||
int dump_ipv4_info(ipv4_info_t *packet, char *buff, size_t size);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ extern "C"
|
||||
} ipv6_info_t;
|
||||
|
||||
int decode_ipv6(ipv6_info_t *packet, const uint8_t *data, uint32_t len);
|
||||
void dump_ipv6_info(uint32_t pkt_id, ipv6_info_t *packet);
|
||||
int dump_ipv6_info(ipv6_info_t *packet, char *buff, size_t size);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ extern "C"
|
||||
} tcp_info_t;
|
||||
|
||||
int decode_tcp(tcp_info_t *packet, const uint8_t *data, uint32_t len);
|
||||
void dump_tcp_info(uint32_t pkt_id, tcp_info_t *packet);
|
||||
int dump_tcp_info(tcp_info_t *packet, char *buff, size_t size);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ extern "C"
|
||||
} udp_info_t;
|
||||
|
||||
int decode_udp(udp_info_t *packet, const uint8_t *data, uint32_t len);
|
||||
void dump_udp_info(uint32_t pkt_id, udp_info_t *packet);
|
||||
int dump_udp_info(udp_info_t *packet, char *buff, size_t size);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
|
||||
@@ -12,27 +12,24 @@ extern "C"
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <sys/stat.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define IP_GET_RAW_VER(raw_pkt) ((((raw_pkt)[0] & 0xf0) >> 4))
|
||||
|
||||
#define PRINT_FILE_INFO 0
|
||||
#define LOG_DEBUG(format, ...) \
|
||||
{ \
|
||||
fprintf(stdout, format "\n", ##__VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
}
|
||||
|
||||
#if (PRINT_FILE_INFO)
|
||||
#define LOG_DEBUG(format, ...) \
|
||||
fprintf(stdout, "[%s-%s()-%05d] " format "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
|
||||
|
||||
#define LOG_ERROR(format, ...) \
|
||||
fprintf(stderr, "[%s-%s()-%05d] " format "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
|
||||
#else
|
||||
#define LOG_DEBUG(format, ...) \
|
||||
fprintf(stdout, format "\n", ##__VA_ARGS__);
|
||||
|
||||
#define LOG_ERROR(format, ...) \
|
||||
fprintf(stderr, format "\n", ##__VA_ARGS__);
|
||||
#endif
|
||||
#define LOG_ERROR(format, ...) \
|
||||
{ \
|
||||
fprintf(stderr, format "\n", ##__VA_ARGS__); \
|
||||
fflush(stderr); \
|
||||
}
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user