diff --git a/example/bench.cpp b/example/bench.cpp index 1c406068..feda61da 100644 --- a/example/bench.cpp +++ b/example/bench.cpp @@ -126,7 +126,7 @@ void bench_mt(int howmany, std::shared_ptr log, int thread_count { threads.push_back(std::thread([&]() { - while (true) + for(;;) { int counter = ++msg_counter; if (counter > howmany) break; diff --git a/include/spdlog/details/logger_impl.h b/include/spdlog/details/logger_impl.h index ae7f5ffa..1e8b020d 100644 --- a/include/spdlog/details/logger_impl.h +++ b/include/spdlog/details/logger_impl.h @@ -37,6 +37,7 @@ inline spdlog::logger::logger(const std::string& logger_name, const It& begin, c _sinks(begin, end), _formatter(std::make_shared("%+")) { + // no support under vs2013 for member initialization for std::atomic _level = level::INFO; } diff --git a/include/spdlog/details/registry.h b/include/spdlog/details/registry.h index 9159dec8..d2988d5a 100644 --- a/include/spdlog/details/registry.h +++ b/include/spdlog/details/registry.h @@ -60,7 +60,8 @@ public: return found->second; auto new_logger = std::make_shared(logger_name, sinks_begin, sinks_end); - new_logger->set_formatter(_formatter); + if (_formatter) + new_logger->set_formatter(_formatter); new_logger->set_level(_level); _loggers[logger_name] = new_logger; return new_logger;