[Logger]: Refactor pipe (#570)
* [Logger]: Refactor pipe * [Logger]: Remove unused function
This commit is contained in:
parent
45bd4e027c
commit
7a2f72f69c
@ -7,7 +7,7 @@ namespace Components
|
|||||||
std::unordered_map<std::string, Game::LocalizeEntry*> Localization::LocalizeMap;
|
std::unordered_map<std::string, Game::LocalizeEntry*> Localization::LocalizeMap;
|
||||||
|
|
||||||
std::optional<std::string> Localization::PrefixOverride;
|
std::optional<std::string> Localization::PrefixOverride;
|
||||||
std::function<void(Game::LocalizeEntry*)> Localization::ParseCallback = nullptr;
|
std::function<void(Game::LocalizeEntry*)> Localization::ParseCallback;
|
||||||
|
|
||||||
void Localization::Set(const std::string& psLocalReference, const std::string& psNewString)
|
void Localization::Set(const std::string& psLocalReference, const std::string& psNewString)
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,8 @@ namespace Components
|
|||||||
std::mutex Logger::MessageMutex;
|
std::mutex Logger::MessageMutex;
|
||||||
std::vector<std::string> Logger::MessageQueue;
|
std::vector<std::string> Logger::MessageQueue;
|
||||||
std::vector<Network::Address> Logger::LoggingAddresses[2];
|
std::vector<Network::Address> Logger::LoggingAddresses[2];
|
||||||
void(*Logger::PipeCallback)(const std::string&) = nullptr;
|
|
||||||
|
std::function<void(const std::string&)> Logger::PipeCallback;
|
||||||
|
|
||||||
bool Logger::IsConsoleReady()
|
bool Logger::IsConsoleReady()
|
||||||
{
|
{
|
||||||
@ -106,21 +107,6 @@ namespace Components
|
|||||||
Logger::MessagePrint(channel, msg);
|
Logger::MessagePrint(channel, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::Flush()
|
|
||||||
{
|
|
||||||
// if (!Game::Sys_IsMainThread())
|
|
||||||
// {
|
|
||||||
// while (!Logger::MessageQueue.empty())
|
|
||||||
// {
|
|
||||||
// std::this_thread::sleep_for(10ms);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
{
|
|
||||||
Logger::Frame();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Logger::Frame()
|
void Logger::Frame()
|
||||||
{
|
{
|
||||||
std::unique_lock _(Logger::MessageMutex);
|
std::unique_lock _(Logger::MessageMutex);
|
||||||
@ -138,7 +124,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::PipeOutput(void(*callback)(const std::string&))
|
void Logger::PipeOutput(const std::function<void(const std::string&)>& callback)
|
||||||
{
|
{
|
||||||
Logger::PipeCallback = callback;
|
Logger::PipeCallback = callback;
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,7 @@ namespace Components
|
|||||||
|
|
||||||
static void Print_Stub(int channel, const char* message, ...);
|
static void Print_Stub(int channel, const char* message, ...);
|
||||||
|
|
||||||
static void PipeOutput(void(*callback)(const std::string&));
|
static void PipeOutput(const std::function<void(const std::string&)>& callback);
|
||||||
|
|
||||||
static void Flush();
|
|
||||||
|
|
||||||
static void PrintInternal(int channel, std::string_view fmt, std::format_args&& args);
|
static void PrintInternal(int channel, std::string_view fmt, std::format_args&& args);
|
||||||
static void ErrorInternal(Game::errorParm_t error, std::string_view fmt, std::format_args&& args);
|
static void ErrorInternal(Game::errorParm_t error, std::string_view fmt, std::format_args&& args);
|
||||||
@ -96,10 +94,13 @@ namespace Components
|
|||||||
static std::mutex MessageMutex;
|
static std::mutex MessageMutex;
|
||||||
static std::vector<std::string> MessageQueue;
|
static std::vector<std::string> MessageQueue;
|
||||||
static std::vector<Network::Address> LoggingAddresses[2];
|
static std::vector<Network::Address> LoggingAddresses[2];
|
||||||
static void(*PipeCallback)(const std::string&);
|
|
||||||
|
static std::function<void(const std::string&)> PipeCallback;
|
||||||
|
|
||||||
static void MessagePrint(int channel, const std::string& msg);
|
static void MessagePrint(int channel, const std::string& msg);
|
||||||
|
|
||||||
static void Frame();
|
static void Frame();
|
||||||
|
|
||||||
static void G_LogPrintf_Hk(const char* fmt, ...);
|
static void G_LogPrintf_Hk(const char* fmt, ...);
|
||||||
static void PrintMessage_Stub();
|
static void PrintMessage_Stub();
|
||||||
static void PrintMessagePipe(const char* data);
|
static void PrintMessagePipe(const char* data);
|
||||||
|
Loading…
Reference in New Issue
Block a user