Leaked source code of windows server 2003
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.

79 lines
1.6 KiB

  1. /******************************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. Logging.cpp
  5. Abstract:
  6. This file contains debugging stuff.
  7. Revision History:
  8. Davide Massarenti (dmassare) 10/31/99
  9. created
  10. ******************************************************************************/
  11. #include "stdafx.h"
  12. #define BUFFER_LINE_LENGTH (1024)
  13. #ifdef DEBUG
  14. void DebugLog( LPCSTR szMessageFmt ,
  15. ... )
  16. {
  17. CHAR rgLine[BUFFER_LINE_LENGTH+1];
  18. va_list arglist;
  19. int iLen;
  20. BOOL bRetVal = TRUE;
  21. //
  22. // Format the log line.
  23. //
  24. va_start( arglist, szMessageFmt );
  25. iLen = _vsnprintf( rgLine, BUFFER_LINE_LENGTH, szMessageFmt, arglist );
  26. va_end( arglist );
  27. //
  28. // Is the arglist too big for us?
  29. //
  30. if(iLen < 0)
  31. {
  32. iLen = BUFFER_LINE_LENGTH;
  33. }
  34. rgLine[iLen] = 0;
  35. ::OutputDebugStringA( rgLine );
  36. }
  37. void DebugLog( LPCWSTR szMessageFmt ,
  38. ... )
  39. {
  40. WCHAR rgLine[BUFFER_LINE_LENGTH+1];
  41. va_list arglist;
  42. int iLen;
  43. BOOL bRetVal = TRUE;
  44. //
  45. // Format the log line.
  46. //
  47. va_start( arglist, szMessageFmt );
  48. iLen = _vsnwprintf( rgLine, BUFFER_LINE_LENGTH, szMessageFmt, arglist );
  49. va_end( arglist );
  50. //
  51. // Is the arglist too big for us?
  52. //
  53. if(iLen < 0)
  54. {
  55. iLen = BUFFER_LINE_LENGTH;
  56. }
  57. rgLine[iLen] = 0;
  58. ::OutputDebugStringW( rgLine );
  59. }
  60. #endif