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.

68 lines
1.1 KiB

  1. //=======================================================================
  2. //
  3. // Copyright (c) 1999 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: applog.h
  6. //
  7. // Purpose: Application logging
  8. //
  9. // History: 22-Feb-99 YAsmi Created
  10. //
  11. //=======================================================================
  12. #ifndef _APPLOG_H_
  13. #define _APPLOG_H_
  14. #define LOG_FIELD_SEPARATOR "|"
  15. class CAppLog
  16. {
  17. public:
  18. CAppLog(LPCTSTR pszLogFileName = NULL);
  19. ~CAppLog();
  20. void SetLogFile(LPCTSTR pszLogFileName);
  21. //
  22. // writing
  23. //
  24. void Log(LPCSTR pszLogStr);
  25. //
  26. // reading
  27. //
  28. void StartReading();
  29. BOOL ReadLine();
  30. LPCSTR GetLineStr();
  31. BOOL CopyNextField(LPSTR pszBuf, int cBufSize);
  32. void StopReading();
  33. static void FormatErrMsg(HRESULT hr, LPSTR pszBuf, int cBufSize);
  34. LPCTSTR GetLogFile()
  35. {
  36. return m_pszLogFN;
  37. }
  38. private:
  39. void CheckBuf(DWORD dwSize);
  40. LPTSTR m_pszLogFN;
  41. LPSTR m_pszLine;
  42. LPSTR m_pszBuf;
  43. DWORD m_dwBufLen;
  44. LPSTR m_pszFldParse;
  45. LPSTR m_pFileBuf;
  46. DWORD m_dwFileOfs;
  47. DWORD m_dwFileSize;
  48. };
  49. #endif // _APPLOG_H_