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.

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