Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: log.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _LOG_H_
  11. #define _LOG_H_
  12. #include <stdio.h>
  13. #define SEV_INFO 0x00000001
  14. #define SEV_FUNCTION 0x00000002
  15. #define SEV_WARNING 0x00000004
  16. #define SEV_ERROR 0x00000008
  17. #ifdef DBG
  18. #define LOGGING
  19. #endif
  20. #ifdef LOGGING
  21. BOOL Log_Init( VOID );
  22. VOID Log( DWORD dwSev, LPSTR lpsz );
  23. VOID Log_Close( VOID );
  24. LPSTR GetSocketMsgSz( INT nSockMsg );
  25. LPSTR GetPacketSz( DWORD dwPkt );
  26. #define DbgLog(sev,a) Log(sev,a)
  27. #define DbgLog1(sev, szFormat, p1) \
  28. { \
  29. CHAR _sz[MAX_PATH]; \
  30. sprintf(_sz, szFormat, p1); \
  31. DbgLog(sev, _sz); \
  32. }
  33. #define DbgLog2(sev, szFormat, p1, p2) \
  34. { \
  35. CHAR _sz[MAX_PATH]; \
  36. sprintf(_sz, szFormat, p1, p2); \
  37. DbgLog(sev, _sz); \
  38. }
  39. #define DbgLog3(sev, szFormat, p1, p2, p3) \
  40. { \
  41. CHAR _sz[MAX_PATH]; \
  42. sprintf(_sz, szFormat, p1, p2, p3); \
  43. DbgLog(sev, _sz); \
  44. }
  45. #define DbgLog4(sev, szFormat, p1, p2, p3, p4) \
  46. { \
  47. CHAR _sz[MAX_PATH]; \
  48. sprintf(_sz, szFormat, p1, p2, p3, p4); \
  49. DbgLog(sev, _sz); \
  50. }
  51. #define DbgMsgBox(a,b) MessageBox( NULL, a, b, MB_OK | MB_ICONEXCLAMATION )
  52. #define DbgMsgBox1(szFormat, szTitle, p1) \
  53. { \
  54. CHAR _sz[MAX_PATH]; \
  55. sprintf(_sz, szFormat, p1); \
  56. DbgMsgBox(_sz, szTitle); \
  57. }
  58. #define DbgMsgBox2(szFormat, szTitle, p1, p2) \
  59. { \
  60. CHAR _sz[2*MAX_PATH]; \
  61. sprintf(_sz, szFormat, p1, p2); \
  62. DbgMsgBox(_sz, szTitle); \
  63. }
  64. #define DbgMsgBox3(szFormat, szTitle, p1, p2, p3) \
  65. { \
  66. CHAR _sz[3*MAX_PATH]; \
  67. sprintf(_sz, szFormat, p1, p2, p3); \
  68. DbgMsgBox(_sz, szTitle); \
  69. }
  70. #define DbgMsgBox4(szFormat, szTitle, p1, p2, p3, p4) \
  71. { \
  72. CHAR _sz[4*MAX_PATH]; \
  73. sprintf(_sz, szFormat, p1, p2, p3, p4); \
  74. DbgMsgBox(_sz, szTitle); \
  75. }
  76. #else // not DBG
  77. #define Log_Init() TRUE
  78. #define Log( dwSev, lpsz )
  79. #define Log_Close()
  80. #define GetSocketMsgSz( nSockMsg ) szNIL
  81. #define GetPacketSz( dwPkt ) szNIL
  82. #define DbgLog(sev,a)
  83. #define DbgLog1(sev,a,b)
  84. #define DbgLog2(sev,a,b,c)
  85. #define DbgLog3(sev,a,b,c,d)
  86. #define DbgLog4(sev,a,b,c,d, e)
  87. #define DbgMsgBox(a,b)
  88. #define DbgMsgBox1(a,b,c)
  89. #define DbgMsgBox2(a,b,c,d)
  90. #define DbgMsgBox3(a,b,c,d,e)
  91. #define DbgMsgBox4(a,b,c,d,e,f)
  92. #endif // not DBG
  93. #endif // _LOG_H_