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.

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