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.

54 lines
1.9 KiB

  1. // LogMsg.h: interface for the LogMsg class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_LOGMSG_H__8A651DB1_D876_11D1_AE27_00C04FA35813__INCLUDED_)
  5. #define AFX_LOGMSG_H__8A651DB1_D876_11D1_AE27_00C04FA35813__INCLUDED_
  6. #if _MSC_VER >= 1000
  7. #pragma once
  8. #endif // _MSC_VER >= 1000
  9. class LogMsg
  10. {
  11. private:
  12. TCHAR m_szLogFile[MAX_PATH];
  13. TCHAR m_szLogModule[MAX_PATH];
  14. int m_temp;
  15. public:
  16. LogMsg (int value);
  17. virtual ~LogMsg ();
  18. DWORD Init (LPCTSTR szLogFile, LPCTSTR szLogModule);
  19. DWORD Log (LPCTSTR file, int line, TCHAR *fmt, ...);
  20. // static LogMsg GetLogObject();
  21. };
  22. // instantiated in LogMsg.cpp.
  23. #ifndef _LOGMESSAGE_CPP_
  24. extern LogMsg thelog;
  25. #endif
  26. // 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 ?
  27. // for example : LOGERROR1(_T("Show Two Values %s, %s"), firstvalue, secondvalue) how to catch this error during compilation ?
  28. #define LOGMESSAGEINIT(logfile, module) thelog.Init(logfile, module)
  29. #define LOGMESSAGE0(msg) thelog.Log(_T(__FILE__), __LINE__, msg)
  30. #define LOGMESSAGE1(msg, arg1) thelog.Log(_T(__FILE__), __LINE__, msg, arg1)
  31. #define LOGMESSAGE2(msg, arg1, arg2) thelog.Log(_T(__FILE__), __LINE__, msg, arg1, arg2)
  32. #define LOGMESSAGE3(msg, arg1, arg2, arg3) thelog.Log(_T(__FILE__), __LINE__, msg, arg1, arg2, arg3)
  33. #define LOGMESSAGE4(msg, arg1, arg2, arg3, arg4) thelog.Log(_T(__FILE__), __LINE__, msg, arg1, arg2, arg3, arg4)
  34. #define LOGMESSAGE5(msg, arg1, arg2, arg3, arg4, arg5) thelog.Log(_T(__FILE__), __LINE__, msg, arg1, arg2, arg3, arg4, arg5)
  35. #endif // !defined(AFX_LOGMSG_H__8A651DB1_D876_11D1_AE27_00C04FA35813__INCLUDED_)