| 74 | } |
| 75 | |
| 76 | [[gnu::format(printf, 5, 0)]] static void log_log_impl(LEVEL level, bool have_color, LOG_COLOR color, const char *sys, const char *fmt, va_list args) |
| 77 | { |
| 78 | // Make sure we're not logging recursively. |
| 79 | if(in_logger) |
| 80 | { |
| 81 | return; |
| 82 | } |
| 83 | in_logger = true; |
| 84 | if(!scope_logger) |
| 85 | { |
| 86 | scope_logger = global_logger.load(std::memory_order_acquire); |
| 87 | } |
| 88 | if(!scope_logger) |
| 89 | { |
| 90 | in_logger = false; |
| 91 | return; |
| 92 | } |
| 93 | |
| 94 | CLogMessage Msg; |
| 95 | Msg.m_Level = level; |
| 96 | Msg.m_HaveColor = have_color; |
| 97 | Msg.m_Color = color; |
| 98 | str_timestamp_format(Msg.m_aTimestamp, sizeof(Msg.m_aTimestamp), FORMAT_SPACE); |
| 99 | Msg.m_TimestampLength = str_length(Msg.m_aTimestamp); |
| 100 | str_copy(Msg.m_aSystem, sys); |
| 101 | Msg.m_SystemLength = str_length(Msg.m_aSystem); |
| 102 | |
| 103 | str_format(Msg.m_aLine, sizeof(Msg.m_aLine), "%s %c %s: ", Msg.m_aTimestamp, "EWIDT"[level], Msg.m_aSystem); |
| 104 | Msg.m_LineMessageOffset = str_length(Msg.m_aLine); |
| 105 | |
| 106 | char *pMessage = Msg.m_aLine + Msg.m_LineMessageOffset; |
| 107 | int MessageSize = sizeof(Msg.m_aLine) - Msg.m_LineMessageOffset; |
| 108 | str_format_v(pMessage, MessageSize, fmt, args); |
| 109 | Msg.m_LineLength = str_length(Msg.m_aLine); |
| 110 | scope_logger->Log(&Msg); |
| 111 | in_logger = false; |
| 112 | } |
| 113 | |
| 114 | void log_log_v(LEVEL level, const char *sys, const char *fmt, va_list args) |
| 115 | { |
no test coverage detected