Replace static_cast with level_to_number in color sinks

This commit is contained in:
gabime 2023-09-24 11:48:46 +03:00
parent 9448d74495
commit 73eb6bc1f5
2 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::log(const details::log_msg &msg
// before color range
print_range_(formatted, 0, msg.color_range_start);
// in color range
print_ccode_(colors_.at(static_cast<size_t>(msg.log_level)));
print_ccode_(colors_.at(level_to_number(msg.log_level)));
print_range_(formatted, msg.color_range_start, msg.color_range_end);
print_ccode_(reset);
// after color range

View File

@ -45,7 +45,7 @@ template<typename ConsoleMutex>
void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::set_color(level level, std::uint16_t color)
{
std::lock_guard<mutex_t> lock(mutex_);
colors_[static_cast<size_t>(level)] = color;
colors_[level_to_number(level)] = color;
}
template<typename ConsoleMutex>