diff options
Diffstat (limited to 'core/logging.c')
-rw-r--r-- | core/logging.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/core/logging.c b/core/logging.c index 06fd95d..3f6404b 100644 --- a/core/logging.c +++ b/core/logging.c @@ -17,7 +17,7 @@ #define LSTR_DEBUG "[DEBUG]" static int debug_enabled = 0; -static int color_enabled = 1; +static int color_enabled = 0; void log_output(int level, const char *fmt, ...) { char out[4096]; @@ -72,10 +72,24 @@ void disable_log_debug(void) { debug_enabled = 0; } +#ifdef _WIN32 + +#include <windows.h> + +void enable_log_color(void) { + HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); + SetConsoleMode(handle, ENABLE_VIRTUAL_TERMINAL_PROCESSING); + color_enabled = 1; +} + +#else + void enable_log_color(void) { color_enabled = 1; } +#endif + void disable_log_color(void) { color_enabled = 0; } |