#include<string>
namespace CommonFunction
{
	std::string getSystemName();
	std::string GetProgramDir();
	std::string GetProgramName();
	int write_log(const char *format, ...);
	int write_list(const char *format, ...);
	int write_sdk(const char *format, ...); 
}
 // 1 fatal 2 error 3 warning 4 trace   从左到右打的日志越多
#define LOG_OFF             0 // close all log
#define LOG_FATAL           1
#define LOG_ERROR           2
#define LOG_WARN            3
#define LOG_TRACE           4 
#define LOG_DEBUG           5
extern int g_current_dbg_level;
#define IOT_PRINT_RAW(Level, _fmt, ...)\
{\
    if (Level <= g_current_dbg_level)\
    {\
        CommonFunction::write_log(_fmt, ##__VA_ARGS__);\
    }\
}
#define PRINFATAL(Fmt, ...)           \
{                                   \
    IOT_PRINT_RAW(LOG_FATAL, Fmt, ##__VA_ARGS__);                  \
}

#define PRINERROR(Fmt, ...)           \
{                                   \
    IOT_PRINT_RAW(LOG_ERROR, Fmt, ##__VA_ARGS__);                  \
}

#define PRINWARN(Fmt, ...)           \
{                                   \
    IOT_PRINT_RAW(LOG_WARN, Fmt, ##__VA_ARGS__);                  \
}

#define PRINTRACE(Fmt, ...)           \
{                                   \
    IOT_PRINT_RAW(LOG_TRACE, Fmt, ##__VA_ARGS__);                  \
} 

#define PRINDEBUG(Fmt, ...)           \
{                                   \
    IOT_PRINT_RAW(LOG_DEBUG, Fmt, ##__VA_ARGS__);                  \
}