Add nullptr check to LogEntry

Also remove explicit comparison with nullptr to make code shorter.
This commit is contained in:
Daniel Lim Wee Soong 2018-03-20 14:15:48 +08:00
parent 2b4998a122
commit ceeb2810fe
1 changed files with 2 additions and 2 deletions

View File

@ -140,7 +140,7 @@ void SetFilter(Filter* new_filter) {
void LogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_num, void LogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_num,
const char* function, const char* format, ...) { const char* function, const char* format, ...) {
if (filter != nullptr && !filter->CheckMessage(log_class, log_level)) if (filter && !filter->CheckMessage(log_class, log_level))
return; return;
std::array<char, 4 * 1024> formatting_buffer; std::array<char, 4 * 1024> formatting_buffer;
va_list args; va_list args;
@ -154,7 +154,7 @@ void LogMessage(Class log_class, Level log_level, const char* filename, unsigned
} }
void LogEntry(Entry& entry) { void LogEntry(Entry& entry) {
if (!filter->CheckMessage(entry.log_class, entry.log_level)) if (filter && !filter->CheckMessage(entry.log_class, entry.log_level))
return; return;
PrintColoredMessage(entry); PrintColoredMessage(entry);