18#ifndef INCLUDED_CLOGGER
19#define INCLUDED_CLOGGER
22#include <fmt/printf.h>
34#define LOGMESSAGE(...) g_Logger->WriteMessage(fmt::sprintf(__VA_ARGS__).c_str(), false)
35#define LOGMESSAGERENDER(...) g_Logger->WriteMessage(fmt::sprintf(__VA_ARGS__).c_str(), true)
36#define LOGWARNING(...) g_Logger->WriteWarning(fmt::sprintf(__VA_ARGS__).c_str())
37#define LOGERROR(...) g_Logger->WriteError (fmt::sprintf(__VA_ARGS__).c_str())
60 CLogger(std::ostream& mainLog, std::ostream& interestingLog,
const bool useDebugPrintf);
117 ScopedReplacement(std::ostream& mainLog, std::ostream& interestingLog,
const bool useDebugPrintf);
CLogger * g_Logger
Definition: CLogger.cpp:55
Definition: Canvas2D.h:36
Replaces g_Logger for as long as it's in scope.
Definition: CLogger.h:115
~ScopedReplacement()
Definition: CLogger.cpp:283
ScopedReplacement(ScopedReplacement &&)=delete
ScopedReplacement & operator=(ScopedReplacement &&)=delete
ScopedReplacement(const ScopedReplacement &)=delete
ScopedReplacement & operator=(const ScopedReplacement &)=delete
CLogger * m_OldLogger
Definition: CLogger.h:127
ScopedReplacement(std::ostream &mainLog, std::ostream &interestingLog, const bool useDebugPrintf)
Definition: CLogger.cpp:277
CLogger m_ThisLogger
Definition: CLogger.h:126
Error/warning/message logging class.
Definition: CLogger.h:48
int m_NumberOfMessages
Definition: CLogger.h:90
bool m_UseDebugPrintf
Definition: CLogger.h:87
void WriteError(const char *message)
Definition: CLogger.cpp:130
void CleanupRenderQueue()
Definition: CLogger.cpp:249
ELogMethod
Definition: CLogger.h:54
@ Normal
Definition: CLogger.h:55
@ Error
Definition: CLogger.h:56
@ Warning
Definition: CLogger.h:57
std::ostream & m_MainLog
Definition: CLogger.h:82
std::ostream & m_InterestingLog
Definition: CLogger.h:83
void PushRenderMessage(ELogMethod method, const char *message)
Definition: CLogger.cpp:225
int m_NumberOfErrors
Definition: CLogger.h:91
std::mutex m_Mutex
Definition: CLogger.h:108
std::deque< RenderedMessage > m_RenderMessages
Definition: CLogger.h:101
void WriteMessage(const char *message, bool doRender)
Definition: CLogger.cpp:109
~CLogger()
Definition: CLogger.cpp:80
void WriteWarning(const char *message)
Definition: CLogger.cpp:150
CLogger(std::ostream &mainLog, std::ostream &interestingLog, const bool useDebugPrintf)
Definition: CLogger.cpp:71
void Render(CCanvas2D &canvas)
Definition: CLogger.cpp:170
double m_RenderLastEraseTime
Definition: CLogger.h:105
int m_NumberOfWarnings
Definition: CLogger.h:92
This is used in the engine to log the messages to the logfiles.
Definition: CLogger.h:134
std::ofstream m_MainLog
Definition: CLogger.h:138
std::ofstream m_InterestingLog
Definition: CLogger.h:139
FileLogger()
Definition: CLogger.cpp:298
CLogger::ScopedReplacement m_ScopedReplacement
Definition: CLogger.h:140
Helper class for unit tests - captures all log output, and returns it as a single string.
Definition: CLogger.h:148
TestLogger()
Definition: CLogger.cpp:304
std::stringstream m_Stream
Definition: CLogger.h:154
CLogger::ScopedReplacement m_ScopedReplacement
Definition: CLogger.h:155
std::string GetOutput()
Definition: CLogger.cpp:308
Helper class for unit tests - redirects all log output to stdout.
Definition: CLogger.h:162
TestStdoutLogger()
Definition: CLogger.cpp:313
CLogger::ScopedReplacement m_ScopedReplacement
Definition: CLogger.h:166
std::string message
Definition: CLogger.h:99
ELogMethod method
Definition: CLogger.h:97
double time
Definition: CLogger.h:98