| 47 | } |
| 48 | |
| 49 | void 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 | |
| 66 | namespace { |
no test coverage detected