TSG-8230 PacketAdapter支持输出json格式的日志,并支持动态调整日志级别

This commit is contained in:
luwenpeng
2021-10-27 20:10:06 +03:00
parent f567aa1d3d
commit f934023b40
12 changed files with 132 additions and 78 deletions

View File

@@ -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
}