Common: Remove async logging
It provided a large increase in complexity of the logging system while having a negligible performance impact: the usage patterns of the ring buffer meant that each log contended with the logging thread, causing it to effectively act as a synchronous extra buffering. Also removed some broken code related to filtering of subclasses which was broken since it was introduced. (Which means no one ever used that feature anyway, since, 8 months later, no one ever complained.)
This commit is contained in:
parent
cb2b2071a8
commit
b88c91dd3d
9 changed files with 32 additions and 222 deletions
|
@ -46,8 +46,8 @@ void FormatLogMessage(const Entry& entry, char* out_text, size_t text_len) {
|
|||
unsigned int time_seconds = static_cast<unsigned int>(entry.timestamp.count() / 1000000);
|
||||
unsigned int time_fractional = static_cast<unsigned int>(entry.timestamp.count() % 1000000);
|
||||
|
||||
const char* class_name = Logger::GetLogClassName(entry.log_class);
|
||||
const char* level_name = Logger::GetLevelName(entry.log_level);
|
||||
const char* class_name = GetLogClassName(entry.log_class);
|
||||
const char* level_name = GetLevelName(entry.log_level);
|
||||
|
||||
snprintf(out_text, text_len, "[%4u.%06u] %s <%s> %s: %s",
|
||||
time_seconds, time_fractional, class_name, level_name,
|
||||
|
@ -116,19 +116,4 @@ void PrintColoredMessage(const Entry& entry) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void TextLoggingLoop(std::shared_ptr<Logger> logger) {
|
||||
std::array<Entry, 256> entry_buffer;
|
||||
|
||||
while (true) {
|
||||
size_t num_entries = logger->GetEntries(entry_buffer.data(), entry_buffer.size());
|
||||
if (num_entries == Logger::QUEUE_CLOSED) {
|
||||
break;
|
||||
}
|
||||
for (size_t i = 0; i < num_entries; ++i) {
|
||||
const Entry& entry = entry_buffer[i];
|
||||
PrintColoredMessage(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue