61 lines
943 B
C
61 lines
943 B
C
#ifndef _LOG_H__
|
|
#define _LOG_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "rest_proxy.h"
|
|
|
|
|
|
|
|
struct log_s
|
|
{
|
|
int log_flag; /* log information */
|
|
char log_file[128];
|
|
FILE *log_fp;
|
|
unsigned int log_nums;
|
|
};
|
|
|
|
extern struct log_s g_log_env;
|
|
|
|
|
|
#define LOG_D(...) \
|
|
do{ \
|
|
if(g_log_env.log_flag) \
|
|
{ \
|
|
g_log_env.log_nums ++; \
|
|
fprintf(g_log_env.log_fp, __VA_ARGS__); \
|
|
printf( __VA_ARGS__); \
|
|
fflush(g_log_env.log_fp); \
|
|
if(g_log_env.log_nums % 2000000==0) \
|
|
log_print(1); \
|
|
} \
|
|
}while(0)
|
|
|
|
|
|
#define LOG_E(...) \
|
|
do{ \
|
|
if(g_log_env.log_flag) \
|
|
{ \
|
|
g_log_env.log_nums ++; \
|
|
fprintf(g_log_env.log_fp, __VA_ARGS__); \
|
|
printf( __VA_ARGS__); \
|
|
fflush(g_log_env.log_fp); \
|
|
if(g_log_env.log_nums % 2000000==0) \
|
|
log_print(1); \
|
|
} \
|
|
}while(0)
|
|
|
|
|
|
int log_print(int index);
|
|
|
|
int rest_proxy_open_log(int index);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|