2015-10-25 11:10:54 +00:00
|
|
|
#pragma once
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-11-06 11:37:21 +00:00
|
|
|
#include "CriticalSection.h"
|
2015-12-04 06:49:31 +00:00
|
|
|
#include "LogClass.h"
|
2015-11-06 11:37:21 +00:00
|
|
|
|
2015-10-25 11:10:54 +00:00
|
|
|
class CTraceModule
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-10-25 11:10:54 +00:00
|
|
|
TraceLevel m_Type;
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
public:
|
2015-10-25 11:10:54 +00:00
|
|
|
CTraceModule () { m_Type = TrLvError; }
|
|
|
|
virtual ~CTraceModule () {}
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-10-25 11:10:54 +00:00
|
|
|
inline void SetTraceLevel ( TraceLevel Type ) { m_Type = Type; }
|
|
|
|
inline TraceLevel GetTraceLevel ( void ) const { return m_Type; }
|
2015-11-06 11:37:21 +00:00
|
|
|
virtual void Write ( const char * Message, bool EndOfLine ) = 0;
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CTraceFileLog : public CTraceModule
|
|
|
|
{
|
2015-10-25 11:10:54 +00:00
|
|
|
enum { MB = 1024 * 1024 };
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-10-25 11:10:54 +00:00
|
|
|
CriticalSection m_CriticalSection;
|
|
|
|
CLog m_hLogFile;
|
|
|
|
bool m_FlushFile;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
public:
|
2015-11-06 11:37:21 +00:00
|
|
|
CTraceFileLog (const char * FileName, bool FlushFile = true);
|
2015-11-06 17:18:44 +00:00
|
|
|
CTraceFileLog(const char * FileName, bool FlushFile, LOG_OPEN_MODE eMode, size_t dwMaxFileSize = 5);
|
2015-10-25 11:10:54 +00:00
|
|
|
virtual ~CTraceFileLog ();
|
|
|
|
|
2015-11-06 11:37:21 +00:00
|
|
|
void Write ( const char * Message, bool EndOfLine );
|
2015-10-25 11:10:54 +00:00
|
|
|
void SetFlushFile ( bool bFlushFile );
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CDebugTraceLog : public CTraceModule
|
|
|
|
{
|
2015-10-25 11:10:54 +00:00
|
|
|
public:
|
2015-11-06 11:37:21 +00:00
|
|
|
void Write ( const char * Message, bool EndOfLine );
|
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
|