diff --git a/src/details/file_helper.cpp b/src/details/file_helper.cpp index 4349b61f..96df3cbe 100644 --- a/src/details/file_helper.cpp +++ b/src/details/file_helper.cpp @@ -6,7 +6,6 @@ #include #include - #include "spdlog/common.h" #include "spdlog/details/os.h" diff --git a/src/details/registry.cpp b/src/details/registry.cpp index a937f05e..b3cfab14 100644 --- a/src/details/registry.cpp +++ b/src/details/registry.cpp @@ -2,6 +2,7 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) #include "spdlog/details/registry.h" + #include "spdlog/common.h" #include "spdlog/logger.h" #include "spdlog/pattern_formatter.h" diff --git a/src/logger.cpp b/src/logger.cpp index 18317532..b97a10c0 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -85,21 +85,20 @@ bool logger::should_flush_(const details::log_msg &msg) { return (msg.log_level >= flush_level) && (msg.log_level != level::off); } - void logger::err_handler_(const std::string &msg) { - if (custom_err_handler_) { - custom_err_handler_(msg); - } else { - using std::chrono::system_clock; - auto now = system_clock::now(); - auto tm_time = details::os::localtime(system_clock::to_time_t(now)); - char date_buf[64]; - std::strftime(date_buf, sizeof(date_buf), "%Y-%m-%d %H:%M:%S", &tm_time); +void logger::err_handler_(const std::string &msg) { + if (custom_err_handler_) { + custom_err_handler_(msg); + } else { + using std::chrono::system_clock; + auto now = system_clock::now(); + auto tm_time = details::os::localtime(system_clock::to_time_t(now)); + char date_buf[64]; + std::strftime(date_buf, sizeof(date_buf), "%Y-%m-%d %H:%M:%S", &tm_time); #if defined(USING_R) && defined(R_R_H) // if in R environment - REprintf("[*** LOG ERROR ***] [%s] [%s] %s\n", date_buf, name().c_str(), msg.c_str()); + REprintf("[*** LOG ERROR ***] [%s] [%s] %s\n", date_buf, name().c_str(), msg.c_str()); #else - std::fprintf(stderr, "[*** LOG ERROR ***] [%s] [%s] %s\n", date_buf, - name().c_str(), msg.c_str()); + std::fprintf(stderr, "[*** LOG ERROR ***] [%s] [%s] %s\n", date_buf, name().c_str(), msg.c_str()); #endif - } } +} } // namespace spdlog