From 7a966d21ef1847763a2e609d9413321189da30dc Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 12 Jan 2019 14:45:27 +0000 Subject: [PATCH] Update spdlog to v1.3.0 --- CMakeLists.txt | 2 +- src/api/helpers/logging.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85678d47..2a64ae55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,7 +152,7 @@ ExternalProject_Add(testing-plugins ExternalProject_Add(spdlog PREFIX "external" - URL "https://github.com/gabime/spdlog/archive/v1.2.1.tar.gz" + URL "https://github.com/gabime/spdlog/archive/v1.3.0.tar.gz" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "") diff --git a/src/api/helpers/logging.h b/src/api/helpers/logging.h index 113d0d2a..0ea37323 100644 --- a/src/api/helpers/logging.h +++ b/src/api/helpers/logging.h @@ -24,6 +24,8 @@ #ifndef LOOT_API_HELPERS_LOGGING #define LOOT_API_HELPERS_LOGGING +#define FMT_USE_STD_STRING_VIEW + #include #include @@ -44,7 +46,10 @@ public: protected: void sink_it_(const spdlog::details::log_msg& msg) override { - callback(mapFromSpdlog(msg.level), fmt::to_string(msg.raw).c_str()); + // string_view isn't necessarily null-terminated, so using + // msg.payload.data() directly isn't a good idea. + std::string payload = std::string(msg.payload.data(), msg.payload.size()); + callback(mapFromSpdlog(msg.level), payload.c_str()); } void flush_() override {}