mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Optimize sqvm and net logger
This commit is contained in:
parent
7b39eb1b42
commit
92673caebd
@ -8,6 +8,9 @@ namespace Hooks
|
||||
NET_SendDatagramFn originalNET_SendDatagram = nullptr;
|
||||
}
|
||||
|
||||
static std::ostringstream oss;
|
||||
static auto ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(oss);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: log the clients signonstate to the console
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -18,8 +21,8 @@ void Hooks::NET_PrintFunc(const char* fmt, ...)
|
||||
static auto iconsole = spdlog::stdout_logger_mt("net_iconsole"); // in-game console
|
||||
static auto wconsole = spdlog::stdout_logger_mt("net_wconsole"); // windows console
|
||||
|
||||
std::ostringstream oss;
|
||||
auto ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(oss);
|
||||
oss.str("");
|
||||
oss.clear();
|
||||
|
||||
iconsole = std::make_shared<spdlog::logger>("ostream", ostream_sink);
|
||||
iconsole->set_pattern("[%S.%e] %v");
|
||||
|
@ -7,6 +7,9 @@ namespace Hooks
|
||||
SQVM_LoadScriptFn originalSQVM_LoadScript = nullptr;
|
||||
}
|
||||
|
||||
static std::ostringstream oss;
|
||||
static auto ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(oss);
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: prints the output of each VM to the console
|
||||
//---------------------------------------------------------------------------------
|
||||
@ -21,8 +24,9 @@ void* Hooks::SQVM_Print(void* sqvm, char* fmt, ...)
|
||||
static auto wconsole = spdlog::stdout_logger_mt("sqvm_wconsole"); // windows console
|
||||
|
||||
std::string vmStr = vmType[vmIdx].c_str();
|
||||
std::ostringstream oss;
|
||||
auto ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(oss);
|
||||
|
||||
oss.str("");
|
||||
oss.clear();
|
||||
|
||||
iconsole = std::make_shared<spdlog::logger>("ostream", ostream_sink);
|
||||
iconsole->set_pattern("[%S.%e] %v");
|
||||
|
@ -550,10 +550,4 @@ void SetupDXSwapChain()
|
||||
{
|
||||
CloseHandle(hThread);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//#################################################################################
|
||||
// UTILS
|
||||
//#################################################################################
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user