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.

56 lines
797 B

  1. /*++
  2. Copyright (C) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. #ifndef _COMMON_H_
  8. #define _COMMON_H_
  9. #include <stdio.h>
  10. #define LOGFILE "LOG.TXT"
  11. // Logging macros
  12. #define _LOGGING
  13. #ifdef _LOGGING
  14. #define INITLOG \
  15. {\
  16. DeleteFile(LOGFILE);\
  17. }
  18. #define LOG(msg) \
  19. {\
  20. FILE *f = fopen(LOGFILE, "a");\
  21. SYSTEMTIME st;\
  22. GetLocalTime(&st);\
  23. fprintf(f, "%u\\%u\\%u %u:%u %s\n", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, msg);\
  24. fclose(f);\
  25. }
  26. #define LOGERROR(msg) \
  27. {\
  28. FILE *f = fopen(LOGFILE, "a");\
  29. SYSTEMTIME st;\
  30. GetLocalTime(&st);\
  31. fprintf(f, "%u\\%u\\%u %u:%2u **ERROR**: %s\n", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, msg);\
  32. fclose(f);\
  33. }
  34. #else
  35. #define INITLOG
  36. #define LOG(msg)
  37. #define ERROR(msg)
  38. #endif // _LOGGING
  39. #endif // _COMMON_H_