Change u8 to ClassType and fix an issue with the latest spdlog on not MSVC

This commit is contained in:
James Rowe 2017-06-23 23:12:58 -06:00
parent c08bc75687
commit b4fab4bd64
2 changed files with 5 additions and 3 deletions

View File

@ -79,7 +79,8 @@ SpdLogBackend::SpdLogBackend() {
sinks.push_back(std::move(color_sink)); sinks.push_back(std::move(color_sink));
// register all of loggers with spdlog // register all of loggers with spdlog
for (u8 log_class = 0; log_class != static_cast<u8>(Log::Class::Count); ++log_class) { for (ClassType log_class = 0; log_class != static_cast<ClassType>(Log::Class::Count);
++log_class) {
loggers[log_class] = spdlog::create(GetLogClassName(static_cast<Log::Class>(log_class)), loggers[log_class] = spdlog::create(GetLogClassName(static_cast<Log::Class>(log_class)),
begin(sinks), end(sinks)); begin(sinks), end(sinks));
} }
@ -101,7 +102,8 @@ void SpdLogImpl(Class log_class, Level log_level, const char* file, int line_num
void SpdLogSetFilter(Filter* filter) { void SpdLogSetFilter(Filter* filter) {
auto loggers = SpdLogBackend::Instance()->GetLoggers(); auto loggers = SpdLogBackend::Instance()->GetLoggers();
auto class_level = filter->GetClassLevel(); auto class_level = filter->GetClassLevel();
for (u8 log_class = 0; log_class != static_cast<u8>(Log::Class::Count); ++log_class) { for (ClassType log_class = 0; log_class != static_cast<ClassType>(Log::Class::Count);
++log_class) {
loggers[log_class]->set_level(GetSpdLogLevel(class_level[log_class])); loggers[log_class]->set_level(GetSpdLogLevel(class_level[log_class]));
} }
} }

View File

@ -9,7 +9,7 @@
namespace Log { namespace Log {
static const char* GetLevelName(spdlog::level_t log_level) { static const char* GetLevelName(spdlog::level::level_enum log_level) {
switch (log_level) { switch (log_level) {
case spdlog::level::trace: case spdlog::level::trace:
return "Trace"; return "Trace";