r5sdk/r5dev/vgui/vgui_debugpanel.h
Kawe Mazidjatari 3f8476db88 Logging system light refactor
* Use responceid from server to determine in which context to log.
* Moved all script loggers from combined enums to minus instead (SERVER = -3, CLIENT = -2, UI = -1 SERVER_CODE = 0, etc), this makes it much easier to align stuff in combined systems such as the RUI logger or NetMsg().
* Color log networked RCON messages properly on the client.
* Added dedicated logger for all received RCON messages (net_console.log).
* Log commands submitted through in-game console (allows for easier debugging when going through log files).
2022-08-03 18:34:44 +02:00

64 lines
1.3 KiB
C++

#pragma once
#include "core/stdafx.h"
#include "mathlib/color.h"
enum class LogType_t : int
{
SCRIPT_SERVER = -3,
SCRIPT_CLIENT,
SCRIPT_UI,
NATIVE_SERVER,
NATIVE_CLIENT,
NATIVE_UI,
NATIVE_ENGINE,
NATIVE_FS,
NATIVE_RTECH,
NATIVE_MS,
NETCON_S,
COMMON_C,
WARNING_C,
ERROR_C,
NONE
};
struct LogMsg_t
{
LogMsg_t(const string svMessage, const int nTicks, const LogType_t type)
{
this->m_svMessage = svMessage;
this->m_nTicks = nTicks;
this->m_type = type;
}
string m_svMessage = "";
int m_nTicks = 1024;
LogType_t m_type = LogType_t::NONE;
};
class CLogSystem
{
public:
void Update(void);
void AddLog(LogType_t type, string svText);
void DrawLog(void);
void DrawHostStats(void) const;
void DrawSimStats(void) const;
void DrawGPUStats(void) const;
void DrawCrosshairMaterial(void) const;
void DrawStreamOverlay(void) const;
private:
Color GetLogColorForType(LogType_t type) const;
vector<LogMsg_t> m_vLogs{};
int m_nFontHeight = 16;
public:
char* m_pszCon_NPrintf_Buf[4096]{};
};
///////////////////////////////////////////////////////////////////////////////
void CEngineVGui_Attach();
void CEngineVGui_Detach();
///////////////////////////////////////////////////////////////////////////////
extern CLogSystem g_pLogSystem;