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.

59 lines
2.0 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. // LogMsg.h: interface for the LogMsg class.
  3. //
  4. //////////////////////////////////////////////////////////////////////
  5. #if !defined(AFX_LOGMSG_H__8A651DB1_D876_11D1_AE27_00C04FA35813__INCLUDED_)
  6. #define AFX_LOGMSG_H__8A651DB1_D876_11D1_AE27_00C04FA35813__INCLUDED_
  7. #define _LOGMESSAGE_INCLUDED_
  8. #include <TCHAR.H>
  9. #if _MSC_VER >= 1000
  10. #pragma once
  11. #endif // _MSC_VER >= 1000
  12. class LogMsg
  13. {
  14. private:
  15. TCHAR m_szLogFile[MAX_PATH];
  16. TCHAR m_szLogModule[MAX_PATH];
  17. int m_temp;
  18. public:
  19. LogMsg (int value);
  20. virtual ~LogMsg ();
  21. DWORD Init (LPCTSTR szLogFile, LPCTSTR szLogModule);
  22. DWORD Log (LPCTSTR file, int line, TCHAR *fmt, ...);
  23. // static LogMsg GetLogObject();
  24. };
  25. // instantiated in LogMsg.cpp.
  26. #ifndef _LOGMESSAGE_CPP_
  27. extern LogMsg thelog;
  28. #endif
  29. // maks_todo : how to make sure that we get compiler error if we use macro with fewer parameters when we should have used macro with more parameters ?
  30. // for example : LOGERROR1(_T("Show Two Values %s, %s"), firstvalue, secondvalue) how to catch this error during compilation ?
  31. #define LOGMESSAGEINIT(logfile, module) thelog.Init(logfile, module)
  32. #define LOGMESSAGE0(msg) thelog.Log(TEXT(__FILE__), __LINE__, msg)
  33. #define LOGMESSAGE1(msg, arg1) thelog.Log(TEXT(__FILE__), __LINE__, msg, arg1)
  34. #define LOGMESSAGE2(msg, arg1, arg2) thelog.Log(TEXT(__FILE__), __LINE__, msg, arg1, arg2)
  35. #define LOGMESSAGE3(msg, arg1, arg2, arg3) thelog.Log(TEXT(__FILE__), __LINE__, msg, arg1, arg2, arg3)
  36. #define LOGMESSAGE4(msg, arg1, arg2, arg3, arg4) thelog.Log(TEXT(__FILE__), __LINE__, msg, arg1, arg2, arg3, arg4)
  37. #define LOGMESSAGE5(msg, arg1, arg2, arg3, arg4, arg5) thelog.Log(TEXT(__FILE__), __LINE__, msg, arg1, arg2, arg3, arg4, arg5)
  38. #endif // !defined(AFX_LOGMSG_H__8A651DB1_D876_11D1_AE27_00C04FA35813__INCLUDED_)