mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 18:11:33 +08:00
Rename func name wincolor sink
This commit is contained in:
parent
c817254495
commit
81e82fb2d3
@ -66,7 +66,7 @@ void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::log(const details::log_msg &msg)
|
|||||||
print_range_(formatted, 0, msg.color_range_start);
|
print_range_(formatted, 0, msg.color_range_start);
|
||||||
|
|
||||||
// in color range
|
// in color range
|
||||||
auto orig_attribs = set_console_attribs(colors_[msg.level]);
|
auto orig_attribs = set_foreground_color_(colors_[msg.level]);
|
||||||
print_range_(formatted, msg.color_range_start, msg.color_range_end);
|
print_range_(formatted, msg.color_range_start, msg.color_range_end);
|
||||||
// reset to orig colors
|
// reset to orig colors
|
||||||
::SetConsoleTextAttribute(out_handle_, orig_attribs);
|
::SetConsoleTextAttribute(out_handle_, orig_attribs);
|
||||||
@ -115,9 +115,9 @@ void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::set_color_mode(color_mode mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set color and return the orig console attributes (for resetting later)
|
// set foreground color and return the orig console attributes (for resetting later)
|
||||||
template<typename ConsoleMutex>
|
template<typename ConsoleMutex>
|
||||||
WORD SPDLOG_INLINE wincolor_sink<ConsoleMutex>::set_console_attribs(WORD attribs)
|
WORD SPDLOG_INLINE wincolor_sink<ConsoleMutex>::set_foreground_color_(WORD attribs)
|
||||||
{
|
{
|
||||||
CONSOLE_SCREEN_BUFFER_INFO orig_buffer_info;
|
CONSOLE_SCREEN_BUFFER_INFO orig_buffer_info;
|
||||||
::GetConsoleScreenBufferInfo(out_handle_, &orig_buffer_info);
|
::GetConsoleScreenBufferInfo(out_handle_, &orig_buffer_info);
|
||||||
|
@ -54,8 +54,9 @@ protected:
|
|||||||
std::unique_ptr<spdlog::formatter> formatter_;
|
std::unique_ptr<spdlog::formatter> formatter_;
|
||||||
std::unordered_map<level::level_enum, WORD, level::level_hasher> colors_;
|
std::unordered_map<level::level_enum, WORD, level::level_hasher> colors_;
|
||||||
|
|
||||||
// set color and return the orig console attributes (for resetting later)
|
// set foreground color and return the orig console attributes (for resetting later)
|
||||||
WORD set_console_attribs(WORD attribs);
|
WORD set_foreground_color_(WORD attribs);
|
||||||
|
|
||||||
// print a range of formatted message to console
|
// print a range of formatted message to console
|
||||||
void print_range_(const fmt::memory_buffer &formatted, size_t start, size_t end);
|
void print_range_(const fmt::memory_buffer &formatted, size_t start, size_t end);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user