mirror of
https://github.com/gabime/spdlog.git
synced 2025-11-16 09:28:56 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdbd64e230 | ||
|
|
88a0e07ad5 | ||
|
|
3f7e502859 | ||
|
|
dd3ca04a7a |
@@ -19,7 +19,11 @@ include(GNUInstallDirs)
|
||||
# Set default build to release
|
||||
# ---------------------------------------------------------------------------------------
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
# Set CMAKE_BUILD_TYPE only if this project is top-level
|
||||
if((DEFINED PROJECT_IS_TOP_LEVEL AND PROJECT_IS_TOP_LEVEL)
|
||||
OR (NOT DEFINED PROJECT_IS_TOP_LEVEL AND CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR))
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
|
||||
@@ -489,7 +489,7 @@ SPDLOG_INLINE void utf8_to_wstrbuf(string_view_t str, wmemory_buf_t &target) {
|
||||
result_size =
|
||||
::MultiByteToWideChar(CP_UTF8, 0, str.data(), str_size, target.data(), result_size);
|
||||
if (result_size > 0) {
|
||||
assert(result_size == target.size());
|
||||
assert(result_size == static_cast<int>(target.size()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +78,10 @@ public:
|
||||
const string_view_t red_bold = "\033[31m\033[1m";
|
||||
const string_view_t bold_on_red = "\033[1m\033[41m";
|
||||
|
||||
private:
|
||||
protected:
|
||||
FILE *target_file_;
|
||||
|
||||
private:
|
||||
mutex_t &mutex_;
|
||||
bool should_do_colors_;
|
||||
std::unique_ptr<spdlog::formatter> formatter_;
|
||||
|
||||
@@ -160,8 +160,8 @@ protected:
|
||||
payload = QString::fromUtf8(str.data(), static_cast<int>(str.size()));
|
||||
// convert color ranges from byte index to character index.
|
||||
if (msg.color_range_start < msg.color_range_end) {
|
||||
color_range_start = QString::fromUtf8(str.data(), msg.color_range_start).size();
|
||||
color_range_end = QString::fromUtf8(str.data(), msg.color_range_end).size();
|
||||
color_range_start = QString::fromUtf8(str.data(), static_cast<qsizetype>(msg.color_range_start)).size();
|
||||
color_range_end = QString::fromUtf8(str.data(), static_cast<qsizetype>(msg.color_range_end)).size();
|
||||
}
|
||||
} else {
|
||||
payload = QString::fromLatin1(str.data(), static_cast<int>(str.size()));
|
||||
@@ -171,7 +171,7 @@ protected:
|
||||
qt_text_edit_, // text edit to append to
|
||||
std::move(payload), // text to append
|
||||
default_color_, // default color
|
||||
colors_.at(msg.level), // color to apply
|
||||
colors_.at(static_cast<size_t>(msg.level)), // color to apply
|
||||
color_range_start, // color range start
|
||||
color_range_end}; // color range end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user