commLOG.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _commLOG_H_
  2. #define _commLOG_H_
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <unistd.h>
  6. #include <sys/types.h>
  7. #include <sys/stat.h>
  8. #include <stdarg.h>
  9. #include <time.h>
  10. #include <assert.h>
  11. #include <errno.h>
  12. #define LOG_SIZE_MAX 4096 //16777216 //1024*1024*16=16M
  13. #define LOG_LINE_MAX 120 //1000
  14. #define LOG_FILE_PATH "/root/door-ctrl/log-door-ctrl" //日志文件路径
  15. #define LOG_PARAMS LOG_FILE_PATH,__FILE__,__func__,__LINE__ //日志文件路径 调用函数所在文件 调用函数名 调用debugInfo时所在行号
  16. //显示调用debugInfo接口的函数所在的文件名、函数名、行号
  17. //调用举例: debuInfo(LOG_PARAMS, “some string %s, some int %d and so on", "hello log", 101);
  18. #if 1
  19. int debugInfo(char *pLogPath, char *pFile, const char *pFuncName, int iLineNumb, char *fmt, ...);
  20. #define DBGLog(fmt, args...) debugInfo(LOG_PARAMS, fmt, ##args)
  21. #else
  22. #define DBGLog(fmt, args...) do{}while(0)
  23. #endif
  24. #define LOG_VS_ERR 0
  25. #define LOG_VS_OK 1
  26. #define LOG_STR_LEN_1024 1024
  27. #define LOG_STR_LEN_512 512
  28. #endif