1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- // Log.h: interface for the CLog class.
- //
- //////////////////////////////////////////////////////////////////////
- //ÈÕÖ¾Éú³ÉÀà
- #if !defined(AFX_LOG_H__AAF3D405_307B_4E82_897B_1B2DA3810F1B__INCLUDED_)
- #define AFX_LOG_H__AAF3D405_307B_4E82_897B_1B2DA3810F1B__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "BaseUtility.h"
- #include "Instance.h"
- class CLog : public Instance<CLog>
- {
- enum enmLogLevel{
- LogLvlFatal = 0,
- LogLvlFailed,
- LogLvlError,
- LogLvlWarnning,
- LogLvlInfo,
- LogLvlTrace,
- LogLvlDebug,
- LogLvlAll
- };
- friend class Instance<CLog>;
- private:
- CLog();
- public:
- ~CLog();
- public:
- void SetMinLevel(UINT nLevel){m_nMinLevel=nLevel;};
- void Put(const wchar_t* pszMsg, UINT nLevel = LogLvlFatal);
- void Put(char* pszMsg, UINT nLevel = LogLvlFatal);
- void PutMsg(const char *szFmt, ...);
- void PutMsg(const wchar_t * szFmt, ...);
- BOOL Init(const char* pszFileName,UINT nMinLevel,UINT nMaxSizeMB=10);
- protected:
- UINT m_nMinLevel;
- UINT m_nMaxLogSize;
- #ifdef _LOGCONSOLE
- CThreadPrintLog _loger;
- #else
- typedef struct __tagLogIndex{
- DWORD dwPos;
- DWORD dwLen;
- BYTE nLevel;
- __tagLogIndex():dwPos(0L),dwLen(0L),nLevel(LogLvlAll)
- {
- };
- }LOGINDEX;
- HANDLE m_hFile;
-
- LOGINDEX m_idx;
- char m_chFileName[260];
- CRITICAL_SECTION m_cs;
- #endif // _DEBUG
- };
- #endif // !defined(AFX_LOG_H__AAF3D405_307B_4E82_897B_1B2DA3810F1B__INCLUDED_)
|