Logging: check for filter before sending to the queue, to skip all heavy formatting on the other thread.

This commit is contained in:
Emmanuel Gil Peyrot 2015-03-06 19:15:02 +01:00
parent 53ba65db43
commit 0aa44e238d
7 changed files with 21 additions and 9 deletions

View file

@ -135,9 +135,18 @@ Entry CreateEntry(Class log_class, Level log_level,
return std::move(entry);
}
static Filter* filter;
void SetFilter(Filter* new_filter) {
filter = new_filter;
}
void LogMessage(Class log_class, Level log_level,
const char* filename, unsigned int line_nr, const char* function,
const char* format, ...) {
if (!filter->CheckMessage(log_class, log_level))
return;
va_list args;
va_start(args, format);
Entry entry = CreateEntry(log_class, log_level,