50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
#ifndef LOG_H_
|
|
#define LOG_H_
|
|
|
|
/** @enum _LOG_LEVEL_
|
|
* LOG等级枚举变量
|
|
*/
|
|
typedef enum
|
|
{
|
|
LOG_Fatal = (1 << 0),
|
|
LOG_Error = (1 << 1),
|
|
LOG_Warn = (1 << 2),
|
|
LOG_Debug = (1 << 3),
|
|
LOG_Info = (1 << 4),
|
|
LOG_Test = (1 << 5),
|
|
LOG_Call = (1 << 6),
|
|
LOG_Devp = (1 << 7),
|
|
LOG_Step = (1 << 8),
|
|
LOG_Unknown = (1 << 9),
|
|
LOG_All = (0xFFFFFFFF),
|
|
LOG_Close = 0x0,
|
|
} LOG_LEVEL;
|
|
|
|
/*! \def LOG_EX
|
|
\brief 系统日志调试宏标识
|
|
*/
|
|
#define LOG_EX(level, format, args...) (IHW_LOG(level, "%s(%d):" format , __FUNCTION__, __LINE__, ##args))
|
|
#define LOG_RAW(level, format, args...) (IHW_LOG_RAW(level, format , ##args))
|
|
|
|
/*! @def DEBUG_CODE_LINE
|
|
@brief 输出当前函数名,行号
|
|
*/
|
|
#define DEBUG_CODE_LINE() (LOG_EX(LOG_Info, "\n"))
|
|
|
|
void IHW_LOG(LOG_LEVEL level, const char* pMsg, ...);
|
|
void IHW_LOG_RAW(LOG_LEVEL level, const char* pMsg, ...);
|
|
void IHW_LOG_BUF(LOG_LEVEL level, const char* pPrefix, unsigned char* pBuf, int iSize);
|
|
|
|
char * strrchr(const char *cp, int ch);
|
|
|
|
char* SysBin2HexStr(char *p, const unsigned char *cp, int count);
|
|
|
|
/* Return the last part of a pathname */
|
|
static inline const char* basename_v2(const char* path)
|
|
{
|
|
const char* tail = strrchr(path, '/');
|
|
return tail ? tail + 1 : path;
|
|
}
|
|
|
|
#endif
|