mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-13 01:10:26 +08:00
Replace static_cast with level_to_number in color sinks
This commit is contained in:
parent
9448d74495
commit
73eb6bc1f5
@ -52,7 +52,7 @@ SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::log(const details::log_msg &msg
|
|||||||
// before color range
|
// before color range
|
||||||
print_range_(formatted, 0, msg.color_range_start);
|
print_range_(formatted, 0, msg.color_range_start);
|
||||||
// in color range
|
// 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_range_(formatted, msg.color_range_start, msg.color_range_end);
|
||||||
print_ccode_(reset);
|
print_ccode_(reset);
|
||||||
// after color range
|
// after color range
|
||||||
|
@ -45,7 +45,7 @@ template<typename ConsoleMutex>
|
|||||||
void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::set_color(level level, std::uint16_t color)
|
void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::set_color(level level, std::uint16_t color)
|
||||||
{
|
{
|
||||||
std::lock_guard<mutex_t> lock(mutex_);
|
std::lock_guard<mutex_t> lock(mutex_);
|
||||||
colors_[static_cast<size_t>(level)] = color;
|
colors_[level_to_number(level)] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ConsoleMutex>
|
template<typename ConsoleMutex>
|
||||||
|
Loading…
Reference in New Issue
Block a user