MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / ClientMsgHandler

Function ClientMsgHandler

Source/Tools/FEXServer/Main.cpp:49–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void ClientMsgHandler(int FD, FEXServerClient::Logging::PacketMsg* const Msg, const char* MsgStr) {
50 if (!StartTime.tv_sec && !StartTime.tv_nsec) {
51 StartTime = Msg->Header.Timestamp;
52 }
53 auto seconds = Msg->Header.Timestamp.tv_sec - StartTime.tv_sec - (Msg->Header.Timestamp.tv_nsec < StartTime.tv_nsec);
54 auto nanos = (1'000'000'000 + Msg->Header.Timestamp.tv_nsec - StartTime.tv_nsec) % 1'000'000'000;
55 char Metadata[128];
56 auto Cursor =
57 fmt::format_to(&Metadata[0], DisableColors.value_or(LogMan::DebugLevelStyle(Msg->Level)), "{}", LogMan::DebugLevelStr(Msg->Level));
58 Cursor = fmt::format_to(Cursor, DisableColors.value_or(fmt::fg(fmt::color::light_gray)), " {}|{} ", Msg->Header.PID, Msg->Header.TID);
59 Cursor = fmt::format_to(Cursor, DisableColors.value_or(fmt::fg(fmt::color::gray)), "{}.{:03}", seconds, nanos / 1000000);
60 *Cursor = 0;
61 auto Output = fmt::format("{} {}\n", Metadata, MsgStr);
62 write(STDERR_FILENO, Output.c_str(), Output.size());
63}
64} // namespace Logging
65
66namespace {

Callers 1

HandleLogDataFunction · 0.85

Calls 6

format_toFunction · 0.85
DebugLevelStyleFunction · 0.85
DebugLevelStrFunction · 0.85
formatFunction · 0.85
writeFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected