2008-09-18 03:15:49 +00:00
|
|
|
#ifndef __TRACE_H__
|
|
|
|
#define __TRACE_H__
|
|
|
|
|
|
|
|
class CTraceModule
|
|
|
|
{
|
|
|
|
TraceLevel m_Type;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CTraceModule () { m_Type = TrLvError; }
|
|
|
|
virtual ~CTraceModule () {}
|
|
|
|
|
|
|
|
inline void SetTraceLevel ( TraceLevel Type ) { m_Type = Type; }
|
|
|
|
inline TraceLevel GetTraceLevel ( void ) const { return m_Type; }
|
|
|
|
virtual void Write ( LPCTSTR Message, bool EndOfLine ) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CTraceFileLog : public CTraceModule
|
|
|
|
{
|
|
|
|
enum { MB = 1024 * 1024 };
|
|
|
|
|
|
|
|
CriticalSection m_CriticalSection;
|
|
|
|
CLog m_hLogFile;
|
|
|
|
bool m_FlushFile;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CTraceFileLog (LPCTSTR FileName, bool FlushFile = true);
|
2010-05-23 10:05:41 +00:00
|
|
|
CTraceFileLog (LPCTSTR FileName, bool FlushFile, LOG_OPEN_MODE eMode, DWORD dwMaxFileSize = 5);
|
2008-09-18 03:15:49 +00:00
|
|
|
virtual ~CTraceFileLog ();
|
|
|
|
|
|
|
|
void Write ( LPCTSTR Message, bool EndOfLine );
|
|
|
|
void SetFlushFile ( bool bFlushFile );
|
|
|
|
};
|
|
|
|
|
|
|
|
class CDebugTraceLog : public CTraceModule
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void Write ( LPCTSTR Message, bool EndOfLine )
|
|
|
|
{
|
|
|
|
OutputDebugString(Message);
|
|
|
|
if (EndOfLine)
|
|
|
|
{
|
2013-04-17 10:29:48 +00:00
|
|
|
OutputDebugString("\n");
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
CTraceModule * AddTraceModule ( CTraceModule * TraceModule ); // Must be created with new
|
|
|
|
CTraceModule * RemoveTraceModule ( CTraceModule * TraceModule ); // Is not automaticly deleted
|
|
|
|
|
|
|
|
#endif // __TRACE_H__
|