diff options
author | Benjamin Barenblat <bbaren@mit.edu> | 2015-08-02 12:55:31 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@mit.edu> | 2015-08-02 12:55:31 -0400 |
commit | 9ff23da2550dd159d81933c0236529ececc526b5 (patch) | |
tree | a0d000b990dd935986bd41437e51f01b97a086bd /src/common/logging/text_formatter.cpp | |
parent | 1af1c5c37b2001f3ae4360c18aac2196be535894 (diff) |
Handle invalid `Log::Level::Count`
Add a case of `Log::Level::Count` to all switch statements that
dispatch on `Log::Level`. The case simply asserts `false` and notes
the invalid log level.
Diffstat (limited to 'src/common/logging/text_formatter.cpp')
-rw-r--r-- | src/common/logging/text_formatter.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index 94f3dfc1fc..e3bb148bb7 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp @@ -14,6 +14,7 @@ #include "common/logging/log.h" #include "common/logging/text_formatter.h" +#include "common/assert.h" #include "common/common_funcs.h" #include "common/string_util.h" @@ -82,6 +83,8 @@ void PrintColoredMessage(const Entry& entry) { color = FOREGROUND_RED | FOREGROUND_INTENSITY; break; case Level::Critical: // Bright magenta color = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; + case Level::Count: + ASSERT_MSG(false, "invalid log level"); break; } SetConsoleTextAttribute(console_handle, color); @@ -101,6 +104,8 @@ void PrintColoredMessage(const Entry& entry) { color = ESC "[1;31m"; break; case Level::Critical: // Bright magenta color = ESC "[1;35m"; break; + case Level::Count: + ASSERT_MSG(false, "invalid log level"); break; } fputs(color, stderr); |