mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Only use WriteConsoleW if the intended output is the console
This commit is contained in:
parent
2d81b2fc33
commit
f9f8cabc4b
|
@ -106,9 +106,9 @@ void dbg_msg(const char *sys, const char *fmt, ...)
|
||||||
loggers[i](str);
|
loggers[i](str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void logger_stdout(const char *line)
|
|
||||||
{
|
|
||||||
#if defined(CONF_FAMILY_WINDOWS)
|
#if defined(CONF_FAMILY_WINDOWS)
|
||||||
|
static void logger_win_console(const char *line)
|
||||||
|
{
|
||||||
#define _MAX_LENGTH 1024
|
#define _MAX_LENGTH 1024
|
||||||
#define _MAX_LENGTH_ERROR (_MAX_LENGTH+32)
|
#define _MAX_LENGTH_ERROR (_MAX_LENGTH+32)
|
||||||
|
|
||||||
|
@ -183,10 +183,13 @@ static void logger_stdout(const char *line)
|
||||||
|
|
||||||
#undef _MAX_LENGTH
|
#undef _MAX_LENGTH
|
||||||
#undef _MAX_LENGTH_ERROR
|
#undef _MAX_LENGTH_ERROR
|
||||||
#else
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void logger_stdout(const char *line)
|
||||||
|
{
|
||||||
printf("%s\n", line);
|
printf("%s\n", line);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void logger_debugger(const char *line)
|
static void logger_debugger(const char *line)
|
||||||
|
@ -206,7 +209,18 @@ static void logger_file(const char *line)
|
||||||
io_flush(logfile);
|
io_flush(logfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dbg_logger_stdout() { dbg_logger(logger_stdout); }
|
void dbg_logger_stdout()
|
||||||
|
{
|
||||||
|
#if defined(CONF_FAMILY_WINDOWS)
|
||||||
|
if(GetFileType(GetStdHandle(STD_OUTPUT_HANDLE)) == FILE_TYPE_CHAR)
|
||||||
|
{
|
||||||
|
dbg_logger(logger_win_console);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
dbg_logger(logger_stdout);
|
||||||
|
}
|
||||||
|
|
||||||
void dbg_logger_debugger() { dbg_logger(logger_debugger); }
|
void dbg_logger_debugger() { dbg_logger(logger_debugger); }
|
||||||
void dbg_logger_file(const char *filename)
|
void dbg_logger_file(const char *filename)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue