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.

98 lines
1.5 KiB

  1. #ifndef WIN32_LEAN_AND_MEAN
  2. #define WIN32_LEAN_AND_MEAN
  3. #endif
  4. #include <windows.h>
  5. #include <windowsx.h>
  6. #include "logit.h"
  7. /*
  8. * lpf
  9. */
  10. void cdecl lpf( LPSTR szFormat, ...)
  11. {
  12. char szStr[256];
  13. va_list ap;
  14. va_start(ap,szFormat);
  15. wvsprintf( szStr, szFormat, ap);
  16. lstrcat( szStr, "\r\n");
  17. OutputDebugString(szStr);
  18. va_end(ap);
  19. } /* lpf */
  20. void LogIt(char *chMsg, char *chFile, UINT uiLine, LOG_TYPE log)
  21. {
  22. char *achLog;
  23. char chBuffer[256];
  24. chBuffer[0] = 0x00;
  25. switch(log)
  26. {
  27. case LOG:
  28. achLog = "Log";
  29. break;
  30. case ABORT:
  31. achLog = "Abort";
  32. break;
  33. case EXIT:
  34. achLog = "Exit";
  35. break;
  36. case INFO:
  37. achLog = "Info";
  38. break;
  39. default:
  40. achLog = "UNKNOWN";
  41. }
  42. wsprintf( chBuffer, "%s %s(%d): %s\r\n", chFile, achLog, uiLine, chMsg);
  43. OutputDebugString(chBuffer);
  44. }
  45. void LogIt2(char *chFile, UINT uiLine, LOG_TYPE log, LPSTR szFormat, ...)
  46. {
  47. char *achLog;
  48. char chBuffer[256];
  49. chBuffer[0] = 0x00;
  50. switch(log)
  51. {
  52. case LOG:
  53. achLog = "Log";
  54. break;
  55. case ABORT:
  56. achLog = "Abort";
  57. break;
  58. case EXIT:
  59. achLog = "Exit";
  60. break;
  61. case INFO:
  62. achLog = "Info";
  63. break;
  64. default:
  65. achLog = "UNKNOWN";
  66. }
  67. wsprintf( chBuffer, "%s %s(%d): ", chFile, achLog, uiLine);
  68. OutputDebugString(chBuffer);
  69. va_list ap;
  70. va_start(ap,szFormat);
  71. wvsprintf( chBuffer, szFormat, ap);
  72. lstrcat( chBuffer, "\r\n");
  73. OutputDebugString(chBuffer);
  74. va_end(ap);
  75. }