mirror of
https://github.com/gabime/spdlog.git
synced 2025-04-01 02:42:41 +08:00
Remove switch statement from wincolor_sink::set_color_mode_impl
This commit is contained in:
parent
91046e6ca4
commit
0ade18828d
@ -108,20 +108,16 @@ void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::set_color_mode(color_mode mode)
|
|||||||
template<typename ConsoleMutex>
|
template<typename ConsoleMutex>
|
||||||
void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::set_color_mode_impl(color_mode mode)
|
void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::set_color_mode_impl(color_mode mode)
|
||||||
{
|
{
|
||||||
switch (mode)
|
if (mode == color_mode::automatic)
|
||||||
{
|
{
|
||||||
case color_mode::always:
|
|
||||||
should_do_colors_ = true;
|
|
||||||
break;
|
|
||||||
case color_mode::never:
|
|
||||||
should_do_colors_ = false;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// should do colors only if out_handle_ points to actual console.
|
// should do colors only if out_handle_ points to actual console.
|
||||||
DWORD console_mode;
|
DWORD console_mode;
|
||||||
bool in_console = ::GetConsoleMode(static_cast<HANDLE>(out_handle_), &console_mode) != 0;
|
bool in_console = ::GetConsoleMode(static_cast<HANDLE>(out_handle_), &console_mode) != 0;
|
||||||
should_do_colors_ = in_console;
|
should_do_colors_ = in_console;
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
should_do_colors_ = mode == color_mode::always ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user