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.
This commit is contained in:
parent
1af1c5c37b
commit
067d2e7e2b
2 changed files with 9 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
#include <array>
|
||||
#include <cstdio>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/common_funcs.h" // snprintf compatibility define
|
||||
#include "common/logging/backend.h"
|
||||
#include "common/logging/filter.h"
|
||||
|
@ -78,8 +79,10 @@ const char* GetLevelName(Level log_level) {
|
|||
LVL(Warning);
|
||||
LVL(Error);
|
||||
LVL(Critical);
|
||||
case Level::Count:
|
||||
ASSERT_MSG(false, "invalid log level");
|
||||
return "Unknown";
|
||||
}
|
||||
return "Unknown";
|
||||
#undef LVL
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue