2022-05-26 23:17:01 +00:00
|
|
|
#ifndef ENGINE_SERVER_SERVER_LOGGER_H
|
|
|
|
#define ENGINE_SERVER_SERVER_LOGGER_H
|
|
|
|
#include <base/logger.h>
|
|
|
|
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
class CServer;
|
|
|
|
|
|
|
|
class CServerLogger : public ILogger
|
|
|
|
{
|
|
|
|
CServer *m_pServer = nullptr;
|
2023-11-10 20:49:42 +00:00
|
|
|
CLock m_PendingLock;
|
2022-05-26 23:17:01 +00:00
|
|
|
std::vector<CLogMessage> m_vPending;
|
|
|
|
std::thread::id m_MainThread;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CServerLogger(CServer *pServer);
|
2023-11-10 20:49:42 +00:00
|
|
|
void Log(const CLogMessage *pMessage) override REQUIRES(!m_PendingLock);
|
2022-05-26 23:17:01 +00:00
|
|
|
// Must be called from the main thread!
|
|
|
|
void OnServerDeletion();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ENGINE_SERVER_SERVER_LOGGER_H
|