mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-24 17:41:34 +08:00
Fix compilations in windows
This commit is contained in:
parent
e63d110baa
commit
e315bcb2a9
3
.gitignore
vendored
3
.gitignore
vendored
@ -93,3 +93,6 @@ cmake-build-*/
|
||||
# macos
|
||||
*.DS_store
|
||||
*.xcodeproj/
|
||||
/.vs
|
||||
/out/build
|
||||
/CMakeSettings.json
|
||||
|
@ -14,7 +14,7 @@ namespace spdlog {
|
||||
|
||||
SPDLOG_INLINE spdlog::log_level level_from_str(const std::string &name) noexcept
|
||||
{
|
||||
const auto *it = std::find(std::begin(level_string_views), std::end(level_string_views), name);
|
||||
auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name);
|
||||
if (it != std::end(level_string_views))
|
||||
return static_cast<log_level>(std::distance(std::begin(level_string_views), it));
|
||||
|
||||
|
@ -24,14 +24,14 @@ SPDLOG_INLINE wincolor_sink<ConsoleMutex>::wincolor_sink(void *out_handle, color
|
||||
|
||||
set_color_mode_impl(mode);
|
||||
// set level colors
|
||||
colors_[log_level::trace] = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; // white
|
||||
colors_[log_level::debug] = FOREGROUND_GREEN | FOREGROUND_BLUE; // cyan
|
||||
colors_[log_level::info] = FOREGROUND_GREEN; // green
|
||||
colors_[spdlog::log_level::warn] = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY; // intense yellow
|
||||
colors_[log_level::err] = FOREGROUND_RED | FOREGROUND_INTENSITY; // intense red
|
||||
colors_[log_level::critical] =
|
||||
colors_.at(to_size_t(log_level::trace)) = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; // white
|
||||
colors_.at(to_size_t(log_level::debug)) = FOREGROUND_GREEN | FOREGROUND_BLUE; // cyan
|
||||
colors_.at(to_size_t(log_level::info)) = FOREGROUND_GREEN; // green
|
||||
colors_.at(to_size_t(spdlog::log_level::warn)) = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY; // intense yellow
|
||||
colors_.at(to_size_t(log_level::err)) = FOREGROUND_RED | FOREGROUND_INTENSITY; // intense red
|
||||
colors_.at(to_size_t(log_level::critical)) =
|
||||
BACKGROUND_RED | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; // intense white on red background
|
||||
colors_[log_level::off] = 0;
|
||||
colors_.at(to_size_t(log_level::off)) = 0;
|
||||
}
|
||||
|
||||
template<typename ConsoleMutex>
|
||||
|
@ -44,7 +44,7 @@ protected:
|
||||
mutex_t &mutex_;
|
||||
bool should_do_colors_;
|
||||
std::unique_ptr<spdlog::formatter> formatter_;
|
||||
std::array<std::uint16_t, log_level::n_levels> colors_;
|
||||
std::array<std::uint16_t, levels_count> colors_;
|
||||
|
||||
// set foreground color and return the orig console attributes (for resetting later)
|
||||
std::uint16_t set_foreground_color_(std::uint16_t attribs);
|
||||
|
Loading…
Reference in New Issue
Block a user