diff --git a/README.md b/README.md index 4eefae6..05a642c 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,10 @@ In addition to all the built-in loguru features, this projects adds: Release notes ------------- +#### 1.0.1 - 2022/02/01 + +- Fix for Windows 10 build + #### 1.0.0 - 2022/01/24 - First release. diff --git a/src/cpp/logging/loguru.cpp b/src/cpp/logging/loguru.cpp index 66e46b3..b4cdc98 100644 --- a/src/cpp/logging/loguru.cpp +++ b/src/cpp/logging/loguru.cpp @@ -1947,31 +1947,43 @@ namespace loguru } } - struct static_string_preamble_handler_t : public preamble_handler_t +} // namespace loguru + +#endif // _WIN32 + +//------------------------------------------------------------------------ +// Additions for rack extension +//------------------------------------------------------------------------ +namespace loguru { + +//------------------------------------------------------------------------ +// static_string_preamble_handler_t +//------------------------------------------------------------------------ +struct static_string_preamble_handler_t : public preamble_handler_t +{ + static_string_preamble_handler_t(char const *iHeader, char const *iEntry) : + fHeader{iHeader ? iHeader : ""}, fEntry{iEntry ? iEntry : ""} {} + + size_t header(char *buffer, size_t buffer_size) override { - static_string_preamble_handler_t(char const *iHeader, char const *iEntry) : - fHeader{iHeader ? iHeader : ""}, fEntry{iEntry ? iEntry : ""} {} - - size_t header(char *buffer, size_t buffer_size) override - { - if(fHeader.empty()) - return 0; - else - return snprintf(buffer, buffer_size, "%-*s", static_cast(std::max(fHeader.size(), fEntry.size())), fHeader.c_str()); - } + if(fHeader.empty()) + return 0; + else + return snprintf(buffer, buffer_size, "%-*s", static_cast(std::max(fHeader.size(), fEntry.size())), fHeader.c_str()); + } - size_t entry(char *buffer, size_t buffer_size) override - { - if(fEntry.empty()) - return 0; - else - return snprintf(buffer, buffer_size, "%s", fEntry.c_str()); - } + size_t entry(char *buffer, size_t buffer_size) override + { + if(fEntry.empty()) + return 0; + else + return snprintf(buffer, buffer_size, "%s", fEntry.c_str()); + } - private: - std::string fHeader; - std::string fEntry; - }; +private: + std::string fHeader; + std::string fEntry; +}; //------------------------------------------------------------------------ // init_for_test @@ -2000,9 +2012,7 @@ void init_for_re(char const *iREName) } } -} // namespace loguru - -#endif // _WIN32 +} #ifdef _WIN32 #ifdef _MSC_VER