| 48 | }; |
| 49 | |
| 50 | inline void SetupAnsi() |
| 51 | { |
| 52 | #ifdef WIN32 |
| 53 | const auto out_handle = GetStdHandle(STD_OUTPUT_HANDLE); |
| 54 | const auto err_handle = GetStdHandle(STD_ERROR_HANDLE); |
| 55 | if (!out_handle || !err_handle) |
| 56 | return; |
| 57 | |
| 58 | unsigned long old_out_mode {}, old_err_mode {}; |
| 59 | if (!GetConsoleMode(out_handle, &old_out_mode) || !GetConsoleMode(err_handle, &old_err_mode)) |
| 60 | return; |
| 61 | |
| 62 | SetConsoleMode(out_handle, old_out_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING); |
| 63 | SetConsoleMode(err_handle, old_err_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING); |
| 64 | #endif |
| 65 | } |
| 66 | |
| 67 | template <Mode LogMode = Mode::None, typename... Args> |
| 68 | bool print(const std::string_view str, Args... args) |