debug.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #pragma once
  2. #include <string>
  3. #include <windows.h>
  4. using namespace std;
  5. #ifdef _UNICODE
  6. #define DebugPrint DebugPrintW
  7. #define DebugPrintSimple
  8. #else
  9. #define DebugPrint DebugPrintA
  10. #define DebugPrintSimple DebugPrintSimpleA
  11. #endif
  12. std::string myformat(const char *fmt, ...) ;
  13. void WINAPI SetDebugPrintFlag(bool Enable);
  14. BOOL WINAPI GetDebugPrintFlag();
  15. void WINAPI SetLogFilePath(const char *pPath);
  16. //extern BOOL dum_log_file;
  17. #define ONE_LOG_MAX_SIZE (524288)
  18. void __DebugPrintSimpleA(
  19. char* format,
  20. ...
  21. );
  22. void __DebugPrintA(
  23. char* file,
  24. int line,
  25. char* function,
  26. char* format,
  27. ...
  28. );
  29. void __DebugPrintW(
  30. char* file,
  31. int line,
  32. char* function,
  33. wchar_t* format,
  34. ...
  35. );
  36. void __ReleasePrintA(
  37. char* file,
  38. int line,
  39. char* function,
  40. char* format,
  41. ...
  42. );
  43. void __ReleasePrintSimpleA(
  44. char* format,
  45. ...
  46. );
  47. void __ReleasePrintW(
  48. char* file,
  49. int line,
  50. char* function,
  51. wchar_t* format,
  52. ...
  53. );
  54. bool InitDumpFile();
  55. #ifdef _DEBUG
  56. #define DebugPrintSimpleA(format,...) __DebugPrintSimpleA(format,__VA_ARGS__)
  57. #define DebugPrintA(format,...) __DebugPrintA(__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  58. #define DebugPrintW(format,...) __DebugPrintW(__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  59. #else
  60. #define DebugPrintSimpleA(format,...) __ReleasePrintSimpleA(format,__VA_ARGS__)
  61. #define DebugPrintA(format,...) __ReleasePrintA(__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  62. #define DebugPrintW(format,...) __ReleasePrintW(__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  63. #endif
  64. //define project name before include debug.h
  65. #if defined _LISMSOCKET
  66. #define PROJECT_NAME "LISM_SOCKET"
  67. #elif defined _LISMSERVER
  68. #define PROJECT_NAME "LISM_SERVER"
  69. #elif defined _LISMCLIENT
  70. #define PROJECT_NAME "LISM_CLIENT"
  71. #elif defined _LISMCONSOLE
  72. #define PROJECT_NAME "LISM_CONSOLE"
  73. #elif defined _LISMDRIVERAPI
  74. #define PROJECT_NAME "LISM_DRIVERAPI"
  75. #elif defined _LISMDADTABASE
  76. #define PROJECT_NAME "LISM_DADTABASE"
  77. #elif 1
  78. #define PROJECT_NAME "E-COM"
  79. #endif
  80. class debug_funcs
  81. {
  82. public:
  83. debug_funcs(void);
  84. virtual ~debug_funcs(void);
  85. };
  86. //new line here------------------------