Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CLogger Class Reference

Error/warning/message logging class. More...

#include <CLogger.h>

Classes

struct  RenderedMessage
 
class  ScopedReplacement
 Replaces g_Logger for as long as it's in scope. More...
 

Public Types

enum  ELogMethod { Normal , Error , Warning }
 

Public Member Functions

 CLogger (std::ostream &mainLog, std::ostream &interestingLog, const bool useDebugPrintf)
 
 ~CLogger ()
 
void WriteMessage (const char *message, bool doRender)
 
void WriteError (const char *message)
 
void WriteWarning (const char *message)
 
void Render (CCanvas2D &canvas)
 

Private Member Functions

 NONCOPYABLE (CLogger)
 
void Init ()
 
void PushRenderMessage (ELogMethod method, const char *message)
 
void CleanupRenderQueue ()
 

Private Attributes

std::ostream & m_MainLog
 
std::ostream & m_InterestingLog
 
bool m_UseDebugPrintf
 
int m_NumberOfMessages {0}
 
int m_NumberOfErrors {0}
 
int m_NumberOfWarnings {0}
 
std::deque< RenderedMessagem_RenderMessages
 
double m_RenderLastEraseTime {-1.0}
 
std::mutex m_Mutex
 

Detailed Description

Error/warning/message logging class.

Thread-safety:

  • Expected to be constructed/destructed in the main thread.
  • The message logging functions may be called from any thread while the object is alive.

Member Enumeration Documentation

◆ ELogMethod

Enumerator
Normal 
Error 
Warning 

Constructor & Destructor Documentation

◆ CLogger()

CLogger::CLogger ( std::ostream &  mainLog,
std::ostream &  interestingLog,
const bool  useDebugPrintf 
)

◆ ~CLogger()

CLogger::~CLogger ( )

Member Function Documentation

◆ CleanupRenderQueue()

void CLogger::CleanupRenderQueue ( )
private

◆ Init()

void CLogger::Init ( )
private

◆ NONCOPYABLE()

CLogger::NONCOPYABLE ( CLogger  )
private

◆ PushRenderMessage()

void CLogger::PushRenderMessage ( ELogMethod  method,
const char *  message 
)
private

◆ Render()

void CLogger::Render ( CCanvas2D canvas)

◆ WriteError()

void CLogger::WriteError ( const char *  message)

◆ WriteMessage()

void CLogger::WriteMessage ( const char *  message,
bool  doRender = false 
)

◆ WriteWarning()

void CLogger::WriteWarning ( const char *  message)

Member Data Documentation

◆ m_InterestingLog

std::ostream& CLogger::m_InterestingLog
private

◆ m_MainLog

std::ostream& CLogger::m_MainLog
private

◆ m_Mutex

std::mutex CLogger::m_Mutex
private

◆ m_NumberOfErrors

int CLogger::m_NumberOfErrors {0}
private

◆ m_NumberOfMessages

int CLogger::m_NumberOfMessages {0}
private

◆ m_NumberOfWarnings

int CLogger::m_NumberOfWarnings {0}
private

◆ m_RenderLastEraseTime

double CLogger::m_RenderLastEraseTime {-1.0}
private

◆ m_RenderMessages

std::deque<RenderedMessage> CLogger::m_RenderMessages
private

◆ m_UseDebugPrintf

bool CLogger::m_UseDebugPrintf
private

The documentation for this class was generated from the following files: