| 1 | #ifndef ENGINE_SERVER_SERVER_LOGGER_H |
|---|---|
| 2 | #define ENGINE_SERVER_SERVER_LOGGER_H |
| 3 | #include <base/logger.h> |
| 4 | |
| 5 | #include <thread> |
| 6 | |
| 7 | class CServer; |
| 8 | |
| 9 | class CServerLogger : public ILogger |
| 10 | { |
| 11 | CServer *m_pServer = nullptr; |
| 12 | CLock m_PendingLock; |
| 13 | std::vector<CLogMessage> m_vPending; |
| 14 | std::thread::id m_MainThread; |
| 15 | |
| 16 | public: |
| 17 | CServerLogger(CServer *pServer); |
| 18 | void Log(const CLogMessage *pMessage) override REQUIRES(!m_PendingLock); |
| 19 | // Must be called from the main thread! |
| 20 | void OnServerDeletion(); |
| 21 | }; |
| 22 | |
| 23 | #endif // ENGINE_SERVER_SERVER_LOGGER_H |
| 24 |