| 139 | VDebug::~VDebug() = default; |
| 140 | |
| 141 | void VDebug::stringify(std::ostream& os) |
| 142 | { |
| 143 | char* b = !m_heap_buffer ? m_stack_buffer : m_heap_buffer.get(); |
| 144 | char const* const end = b + m_bytes_used; |
| 145 | uint64_t timestamp = *reinterpret_cast<uint64_t*>(b); |
| 146 | b += sizeof(uint64_t); |
| 147 | std::thread::id threadid = *reinterpret_cast<std::thread::id*>(b); |
| 148 | b += sizeof(std::thread::id); |
| 149 | string_literal_t file = *reinterpret_cast<string_literal_t*>(b); |
| 150 | b += sizeof(string_literal_t); |
| 151 | string_literal_t function = *reinterpret_cast<string_literal_t*>(b); |
| 152 | b += sizeof(string_literal_t); |
| 153 | uint32_t line = *reinterpret_cast<uint32_t*>(b); |
| 154 | b += sizeof(uint32_t); |
| 155 | LogLevel loglevel = *reinterpret_cast<LogLevel*>(b); |
| 156 | b += sizeof(LogLevel); |
| 157 | if (m_logAll) { |
| 158 | format_timestamp(os, timestamp); |
| 159 | |
| 160 | os << '[' << to_string(loglevel) << ']' << '[' << threadid << ']' << '[' |
| 161 | << file.m_s << ':' << function.m_s << ':' << line << "] "; |
| 162 | } |
| 163 | |
| 164 | stringify(os, b, end); |
| 165 | os << std::endl; |
| 166 | |
| 167 | if (loglevel >= LogLevel::CRIT) os.flush(); |
| 168 | } |
| 169 | |
| 170 | template <typename Arg> |
| 171 | char* decode(std::ostream& os, char* b, Arg* /*dummy*/) |
no test coverage detected